communes_CH_indicators: Swiss communes socio-demographic indicators

Description Usage Arguments Details Value See Also Examples

Description

Load socio-demographic data by the Swiss Statistical Office.

Process Portraits régionaux de la Suisse commune xls

Load the NPA/PLZ/ Zip code for Switzerland

Usage

1
2
3
4
5
6
loadCommunesCHportraits()

processPortraitsRegionauxCommune(file = "je-f-21.03.01.xls",
  output = "communesCH_2016_indicators_je-f-21.03.01.csv")

loadCHzipcode()

Arguments

file

the raw excel file name from the Swiss Statistical office with indicators by commune

output

the output file name to be saved in the package inst/extdata

Details

Run processPortraitsRegionauxCommune() to generate a readable csv file for loadCommunesCHportraits

The matrix has the commune BFS code as rowname and 3 attributes:

Value

a matrix

a data.frame

See Also

Office fédéral de la statistique > Les Régions > Communes > Données et explications (portraits): https://www.bfs.admin.ch/bfs/fr/home/statistiques/statistique-regions/portraits-regionaux-chiffres-cles/communes.assetdetail.328133.html
The cleaning up of raw xls file:

http://opendata.admin.ch/de/dataset/ch-swisstopo-vd-ortschaftenverzeichnis_plz/resource/35001b61-e7c1-4124-89fa-17fac7b1139e from: http://opendata.admin.ch/de/dataset/ch-swisstopo-vd-ortschaftenverzeichnis_plz

http://opendata.admin.ch/de/dataset/ch-swisstopo-vd-ortschaftenverzeichnis_plz/resource/35001b61-e7c1-4124-89fa-17fac7b1139e from: http://opendata.admin.ch/de/dataset/ch-swisstopo-vd-ortschaftenverzeichnis_plz

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
communeData <- loadCommunesCHportraits()
colnames(communeData)
rownames(communeData)

# Select only "surface" indicators
colIdx <- which(attr(communeData, "indicatorGroup") == "Surface")
head(communeData[,colIdx])

zipcode <- loadCHzipcode()
match(zipcode$Gemeindename, attr(communeData, "communeName"))
##' \dontrun{
  colnames(data)
  g1 <- ggplot(data = as.data.frame(data), aes(x = `Etrangers en %`, y = UDC)) + 
  geom_point(aes(size = Habitants), alpha = 0.5, colour = swiTheme::swi_col[1]) 
  g1 + swiTheme::swi_theme()
}

## Not run: 
processPortraitsRegionauxCommune()

## End(Not run)

d-qn/swiMap documentation built on May 14, 2019, 3:04 p.m.