get_data {SUNGEO} | R Documentation |
Download data from SUNGEO server
Description
Function to download data files through the SUNGEO API. Function produces a data.table object, corresponding to the user's choice of countries, topics, sources, and spatial and temporal units.
Usage
get_data(
country_names = NULL,
country_iso3 = NULL,
geoset = "GADM",
geoset_yr = 2018,
space_unit = "adm1",
time_unit = "year",
topics = NULL,
year_min = 1990,
year_max = 2017,
print_url = TRUE,
print_time = TRUE,
error_stop = FALSE,
by_topic = TRUE,
skip_missing = TRUE,
cache_param = FALSE,
short_message = TRUE
)
Arguments
country_names |
Country name(s). Character string (single country) or vector of character strings (multiple countries). |
country_iso3 |
Country code (ISO 3166-1 alpha-3). Character string (single country) or vector of character strings (multiple countries). |
geoset |
Name of geographic boundary set. Can be one of |
geoset_yr |
Year of geographic boundaries. See |
space_unit |
Geographic level of analysis. Can be one of |
time_unit |
Temporal level of analysis. Can be one of |
topics |
Data topics. See |
year_min |
Time range of requested data: start year. See |
year_max |
Time range of requested data: end year. See |
print_url |
Print url string of requested data to console? Default is |
print_time |
Print processing time for API query to console? Default is |
error_stop |
Error handling. If |
by_topic |
Break query down by topic and country? If |
skip_missing |
Skip missing data topics? If |
cache_param |
Store cached query on server? This can speed up processing for repeated queries. Default is |
short_message |
Shorten error messages? If |
Value
data.table object, with requested data from SUNGEO API.
See Also
Examples
# Single country, single topic
## Not run:
out_1 <- get_data(country_name="Afghanistan",topics="Demographics:Population:GHS")
out_1
## End(Not run)
## Not run:
out_2 <- get_data(
country_name=c("Afghanistan","Moldova"),
topics=c("Demographics:Ethnicity:EPR","Demographics:Population:GHS"))
out_2
## End(Not run)
# Other boundary sets, spatial and time units
## Not run:
out_3 <- get_data(
country_name="Albania",
topics="Weather:AirTemperatureAndPrecipitation:NOAA",
geoset="GAUL",geoset_yr=1990,space_unit="adm2",time_unit="month",
year_min=1990,year_max=1991)
out_3
## End(Not run)