Downloads codelist (registry table) and returns it in a tibble. Codelists are canonical lists of entities, their names and IDs. See Details. Codelists are included in catalogue which can be retrieved using czso_get_catalogue(). Their IDs start with "cis" followed by a two- to three-digit number.

czso_get_codelist(
  codelist_id,
  language = c("cs", "en"),
  dest_dir = NULL,
  resource_num = NULL,
  force_redownload = F
)

Arguments

codelist_id

character or numeric of length 1 or 2; ID of codelist to download. See Details.

language

language, either "cs" (the default) or "en", which is available for some codelists.

dest_dir

character. Directory in which downloaded files will be stored. If left unset, will use the czso.dest_dir option if the option is set, and tempdir() otherwise. Will be created if it does not exist.

resource_num

integer, order of resource. Only override if you need a different format.

force_redownload

whether to download even if a cached local file is available.

Value

a tibble All columns except dates kept as character. See Details for the columns.

Details

Codelists

Codelists are canonical registries of entities: things, statistical areas and aggregates, concepts, categorisations. A codelist typically contains IDs and names of all the entities fitting into a certain category.

The most commonly used codelists are geographical, e.g. lists of regions or municipalities.

In the world of the CZSO, each codelist has a numeric ID of two to four digits. You can pass this number to the function (even as a string), or you can pass the dataset ID found in the catalogue; the latter will have the form of e.g. "cisNN".

Relationships between codelists ("vazba mezi číselníky")

The CZSO data store also holds tables describing relations between codelists. This is especially useful for spatial hierarchies (e.g. which towns belong to which region), or for converting between categorisations (e.g. two different sets of IDs for regions.)

You can pass a vector of two IDs (numeric or character) and if the relational table for these two exists, it will be returned. (If it does not work, try flipping them around). The equivalent dataset ID, as found in the catalogue, is "cisXXvazYY".

Columns in output

For single-codelist files, see below for the most commonly included columns. For relational tables, you will see each column twice, each time with a suffix of 1 or 2.

  • AKRCIS: codelist abbreviation

  • KODCIS: codelist ID

  • CHODNOTA: entity ID

  • TEXT: entity name

  • ZKRTEXT: entity name abbreviated

  • ADMPLOD: valid from

  • ADMNEPO: invalid after

  • KOD_RUIAN: for geographical entites, RUIAN code (different master registry run by the geodesists)

  • CZNUTS: for geographical entities, NUTS code

See also

Examples

# \donttest{
czso_get_codelist("cis100")
#> # A tibble: 15 × 11
#>    kodjaz akrcis  kodcis chodnota zkrtext text  admplod admnepo cznuts kod_ruian
#>    <chr>  <chr>   <chr>  <chr>    <chr>   <chr> <chr>   <chr>   <chr>  <chr>    
#>  1 CS     KRAJ_N… 100    3000     Extra-… Extr… 2004-0… 9999-0… CZZZZ  NA       
#>  2 CS     KRAJ_N… 100    3018     Hl. m.… Hlav… 2001-0… 9999-0… CZ010  19       
#>  3 CS     KRAJ_N… 100    3026     Středo… Stře… 2001-0… 9999-0… CZ020  27       
#>  4 CS     KRAJ_N… 100    3034     Jihoče… Jiho… 2001-0… 9999-0… CZ031  35       
#>  5 CS     KRAJ_N… 100    3042     Plzeňs… Plze… 2001-0… 9999-0… CZ032  43       
#>  6 CS     KRAJ_N… 100    3051     Karlov… Karl… 2001-0… 9999-0… CZ041  51       
#>  7 CS     KRAJ_N… 100    3069     Ústeck… Úste… 2001-0… 9999-0… CZ042  60       
#>  8 CS     KRAJ_N… 100    3077     Libere… Libe… 2001-0… 9999-0… CZ051  78       
#>  9 CS     KRAJ_N… 100    3085     Králov… Král… 2001-0… 9999-0… CZ052  86       
#> 10 CS     KRAJ_N… 100    3093     Pardub… Pard… 2001-0… 9999-0… CZ053  94       
#> 11 CS     KRAJ_N… 100    3107     Kraj V… Kraj… 2001-0… 9999-0… CZ063  108      
#> 12 CS     KRAJ_N… 100    3115     Jihomo… Jiho… 2001-0… 9999-0… CZ064  116      
#> 13 CS     KRAJ_N… 100    3123     Olomou… Olom… 2001-0… 9999-0… CZ071  124      
#> 14 CS     KRAJ_N… 100    3131     Zlínsk… Zlín… 2001-0… 9999-0… CZ072  141      
#> 15 CS     KRAJ_N… 100    3140     Moravs… Mora… 2001-0… 9999-0… CZ080  132      
#> # ℹ 1 more variable: zkrkraj <chr>

# equivalent
czso_get_codelist(100)
#>  File already in /tmp/RtmprvhYAA/cis100, not downloading.
#> Set `force_redownload = TRUE` if needed.
#> # A tibble: 15 × 11
#>    kodjaz akrcis  kodcis chodnota zkrtext text  admplod admnepo cznuts kod_ruian
#>    <chr>  <chr>   <chr>  <chr>    <chr>   <chr> <chr>   <chr>   <chr>  <chr>    
#>  1 CS     KRAJ_N… 100    3000     Extra-… Extr… 2004-0… 9999-0… CZZZZ  NA       
#>  2 CS     KRAJ_N… 100    3018     Hl. m.… Hlav… 2001-0… 9999-0… CZ010  19       
#>  3 CS     KRAJ_N… 100    3026     Středo… Stře… 2001-0… 9999-0… CZ020  27       
#>  4 CS     KRAJ_N… 100    3034     Jihoče… Jiho… 2001-0… 9999-0… CZ031  35       
#>  5 CS     KRAJ_N… 100    3042     Plzeňs… Plze… 2001-0… 9999-0… CZ032  43       
#>  6 CS     KRAJ_N… 100    3051     Karlov… Karl… 2001-0… 9999-0… CZ041  51       
#>  7 CS     KRAJ_N… 100    3069     Ústeck… Úste… 2001-0… 9999-0… CZ042  60       
#>  8 CS     KRAJ_N… 100    3077     Libere… Libe… 2001-0… 9999-0… CZ051  78       
#>  9 CS     KRAJ_N… 100    3085     Králov… Král… 2001-0… 9999-0… CZ052  86       
#> 10 CS     KRAJ_N… 100    3093     Pardub… Pard… 2001-0… 9999-0… CZ053  94       
#> 11 CS     KRAJ_N… 100    3107     Kraj V… Kraj… 2001-0… 9999-0… CZ063  108      
#> 12 CS     KRAJ_N… 100    3115     Jihomo… Jiho… 2001-0… 9999-0… CZ064  116      
#> 13 CS     KRAJ_N… 100    3123     Olomou… Olom… 2001-0… 9999-0… CZ071  124      
#> 14 CS     KRAJ_N… 100    3131     Zlínsk… Zlín… 2001-0… 9999-0… CZ072  141      
#> 15 CS     KRAJ_N… 100    3140     Moravs… Mora… 2001-0… 9999-0… CZ080  132      
#> # ℹ 1 more variable: zkrkraj <chr>

# get a table of relations between two codelists
czso_get_codelist(c(100, 43))
#> # A tibble: 6,258 × 10
#>    kodjaz typvaz akrcis1 kodcis1 chodnota1 text1 akrcis2 kodcis2 chodnota2 text2
#>    <chr>  <chr>  <chr>   <chr>   <chr>     <chr> <chr>   <chr>   <chr>     <chr>
#>  1 CS     Odvoz… KRAJ_N… 100     3018      Hlav… CISOB   43      554782    Praha
#>  2 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      503410    Žito…
#>  3 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      505781    Zápy 
#>  4 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      512991    Drnek
#>  5 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513032    Kame…
#>  6 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513041    Lhota
#>  7 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513075    Hobš…
#>  8 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513113    Malé…
#>  9 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513130    Dola…
#> 10 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513148    Poln…
#> # ℹ 6,248 more rows

# equivalent
czso_get_codelist("cis100vaz43")
#>  File already in /tmp/RtmprvhYAA/cis100vaz43, not downloading.
#> Set `force_redownload = TRUE` if needed.
#> # A tibble: 6,258 × 10
#>    kodjaz typvaz akrcis1 kodcis1 chodnota1 text1 akrcis2 kodcis2 chodnota2 text2
#>    <chr>  <chr>  <chr>   <chr>   <chr>     <chr> <chr>   <chr>   <chr>     <chr>
#>  1 CS     Odvoz… KRAJ_N… 100     3018      Hlav… CISOB   43      554782    Praha
#>  2 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      503410    Žito…
#>  3 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      505781    Zápy 
#>  4 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      512991    Drnek
#>  5 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513032    Kame…
#>  6 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513041    Lhota
#>  7 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513075    Hobš…
#>  8 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513113    Malé…
#>  9 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513130    Dola…
#> 10 CS     Odvoz… KRAJ_N… 100     3026      Stře… CISOB   43      513148    Poln…
#> # ℹ 6,248 more rows
# }