Thanks to Eva Van Belle pointing out issues with Appenzell postcodes, I’m happy to announce an update to the postcode to cantons conversion script for R. It’s essentially a database with Swiss postcodes (PLZ) and what canton they are in. For 16 postcodes only a probabilistic assignment is possible, and this is handled by siding with the (typically much) larger municipality.
Convert Swiss postcodes to cantons: https://gist.github.com/druedin/6690720
Two simple helper functions to go with: https://gist.github.com/druedin/8758265