demo.R 1.45 KB
Newer Older
1
2
# When the package will be finished, install via CRAN
# install.packages("fso.metadata")
3
4
5
6

# Currently use:
devtools::install_url("https://renkulab.io/gitlab/dscc/metadata-auto-r-library/-/archive/v002/metadata-auto-r-library-v002.tar.gz")
library("fso.metadata")
7
8


9
10
11
12
13
## Get a codelist
# All languages
codelist <- get_codelist(identifier='CL_NOGA_SECTION')
names(codelist)
head(codelist)
14
15
16

# In french
codelist <- get_codelist(identifier='CL_NOGA_SECTION', language='fr')
17
18
names(codelist)

19
20
21
head(codelist$label.fr)
head(codelist$id)

22

23
## Get a nomenclature of one level
24
25
26
27
28
29
30
31
# All language: Level 1
nomenclature <- get_nomenclature_one_level(
  identifier='HCL_CH_ISCO_19_PROF', level_number=2
)
names(nomenclature)
head(nomenclature, 5)

# French: Level 2
32
nomenclature_fr <- get_nomenclature_one_level(
33
  identifier='HCL_CH_ISCO_19_PROF', level_number=1, language='fr'
34
)
35
36
names(nomenclature_fr)
head(nomenclature_fr, 5)
37
38

nomenclature_de <- get_nomenclature_one_level(
39
  identifier='HCL_CH_ISCO_19_PROF', level_number=1, language='de'
40
)
41
42
names(nomenclature_de)
head(nomenclature_de, 5)
43
44
45
46
47

## Get a nomenclature of multiple levels
# French
multi_nomenclature_fr <- get_nomenclature_multiple_levels(
  identifier='HCL_CH_ISCO_19_PROF', 
48
  level_from=1, 
49
50
51
  level_to=5, 
  language='fr'
)
52
head(multi_nomenclature_fr, 5)
53
54
55
56

# German
multi_nomenclature_de <- get_nomenclature_multiple_levels(
  identifier='HCL_CH_ISCO_19_PROF', 
57
  level_from=2, 
58
59
60
  level_to=3, 
  language='de'
)
61
62
head(multi_nomenclature_de, 5)