Description Usage Arguments Details Value References See Also Examples
Detailed information about a database table and its classification on the open-data API which is supported by National Statistical Office of Mongolia (NSO)
1 | get_table_info(tbl_id, simplify = FALSE, try = FALSE, timeout = Inf)
|
tbl_id |
character string, Table identification number |
simplify |
logical: Should the result be simplified to a vector and a data frame? |
try |
logical: Should the body of the function be wrapped by the function |
timeout |
positive numeric or |
The NSO server returns "HTTP error 500" frequently. Due to the server error, error handling is supported. if try
is TRUE
, you have to write code with error handling as shown in the example.
A list which contains information about database table and its classification if the function is executed without error, but an object of class "try-error" containing the error message, if it fails. The list has following structure:
Table identification number
Unit identification number
Unit name in Mongolia
Unit name in English
Table classification:
Variable identification
Variable identification number
Field name
Variable name in Mongolian
Variable identification
Variable classification and code:
Classification number
Sub-classification
Classification name in Mongolian
Classification name in English
if simplify
is TRUE
, an user-friendly result is returned.
http://opendata.1212.mn/en/doc/Api/GET-api-Itms-id
all_tables, get_table, get_sector_info
1 2 3 4 5 6 7 8 9 10 11 | # tree shaped result
table_info <- get_table_info("DT_NSO_2400_015V2", try = TRUE,, timeout = 4)
if (!inherits(table_info, "try-error")) {
str(table_info)
}
# tabular result
table_info_simplified <- get_table_info(
"DT_NSO_2400_015V2", simplify = TRUE, try = TRUE, timeout = 4)
if (!inherits(table_info_simplified, "try-error")) {
str(table_info_simplified)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.