require(DescTools)
try( {
# Representation of the language areas in CH combined via cantons
# by majority per canton
tkt <- table(d.bfsrg$kt_c, d.bfsrg$sprgeb_x)
grp <- unique(d.bfsrg$sprgeb_x)[apply(tkt, 1, which.max)]
# combine and plot cantons
plot(CombineKant(rownames(tkt), grp), col=SetAlpha(c(horange, hyellow, hecru), 0.8),
border="grey40", main="Languages in CH")
# copyright is mandatory for these SFSO maps
BfSStamp()
# waters make the maps more realistic ...
AddLakes(col = "grey80", border = "grey40")
})
Run the code above in your browser using DataLab