czso_get_table: Retrieve and read dataset from CZSO

Description Usage Arguments Details Value Note See Also Examples

View source: R/core.R

Description

Downloads and reads dataset identified by dataset_id. Unzips if necessary, but only loads CSV files, otherwise returns the path to the downloaded file. Converts types of columns where known, e.g. value columns to numeric.

Usage

1
2
3
4
5
6
czso_get_table(
  dataset_id,
  dest_dir = NULL,
  force_redownload = FALSE,
  resource_num = 1
)

Arguments

dataset_id

a character. Found in the czso_id column of data frame returned by get_catalogue().

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.

force_redownload

integer. Whether to redownload data source file even if already cached. Defaults to FALSE.

resource_num

integer. Order of resource in resource list for the given dataset. Defaults to 1, the normal value for CZSO datasets.

Details

Structure of the output tibble

CZSO provides its open data as tidy data, so each row only contains one value in the hodnota column and the remaining columns give details on how that value is defined. See "Included columns" below on how these work.

Data types

The schema of the dataset is not yet used, so some columns may be mistyped and are by default returned as character vectors.

Included columns

The range of columns present in the output varies from one dataset to another, so the package does not attempt to provide English-language names for the known subset, as that would result in a jumble of Czenglish.

Instead, here is a guide to some of the common column names you will encounter:

Other metadata will come in the form {variable}_[txt|cis|kod]. The _txt column holds the Czech text name for the category. The _cis column holds the ID of the codelist (register) you need to decode the code in _kod. The English codelists are at http://apl.czso.cz/iSMS/en/cislist.jsp, Czech ones at http://apl.czso.cz/iSMS/cs/cislist.jsp. You can find the Czech-language codelists in the catalogue retrieved with czso_get_catalogue(), where their IDs begin with "cis" followed by the number; the English ones can also be retrieved from the link above using a permalink URL.

More conveniently, you can use the czso_get_codelist() function to retrieve the codelist.

Units are denoted in a separate column.

A helper on common breakdowns with their associated columns:

NAs in "breakdown" columns (e.g. gender or age) denote the total.

Value

a tibble, or vector of file paths if file is not CSV or if there are multiple files in the dataset. See Details on the columns contained in the tibble

Note

Do not use this for harvesting datasets from CZSO en masse.

See Also

Other Core workflow: czso_get_catalogue(), get_table()

Examples

1
czso_get_table("110080")

czso documentation built on March 1, 2021, 5:07 p.m.