get_table_info {NSO1212} | R Documentation |
Detailed Information about a Database Table and Its Classification
Description
Detailed information about a database table and its classification on the open-data API which is supported by National Statistical Office of Mongolia (NSO)
Usage
get_table_info(tbl_id, simplify = FALSE, try = FALSE, timeout = Inf)
Arguments
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 |
Details
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.
Value
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:
- tbl_id
Table identification number
- unit_id
Unit identification number
- unit_nm
Unit name in Mongolia
- unit_eng_nm
Unit name in English
- obj
Table classification:
- obj_var_id
Variable identification
- var_ord_sn
Variable identification number
- field
Field name
- scr_mn
Variable name in Mongolian
- scr_eng
Variable identification
- itm
Variable classification and code:
- itm_id
Classification number
- up_itm_id
Sub-classification
- scr_mn
Classification name in Mongolian
- scr_eng
Classification name in English
if simplify
is TRUE
, an user-friendly result is returned.
References
http://opendata.1212.mn/en/doc/Api/GET-api-Itms-id
See Also
all_tables, get_table, get_sector_info
Examples
# 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)
}