Download data.un.org tables as csvs
download_undata_table( table_url, output_dir, record_limit = 1e+05, download_sleep = 30, base_url = "http://data.un.org/Data.aspx", downloader_url = "http://data.un.org/Handlers/DownloadHandler.ashx" )
| table_url | [ |
|---|---|
| output_dir | [ |
| record_limit | [ |
| download_sleep | [ |
| base_url | [ |
| downloader_url | The base url of the data.un.org site download interfact. Default is 'http://data.un.org/Handlers/DownloadHandler.ashx'. |
[character()] file paths for each separate file downloaded.
A list of all possible tables is shown here http://data.un.org/Explorer.aspx. Currently this function assumes one is able to filter by Year when downloading data.
The 'data.un.org' website does not allow one to download more than 100,000
records at a time. In order to account for this, we loop through groups of
years that stay below the limit. This means table_url should not already
include specified filters for years as this function is intended to download
all years of data.
Other get_undata:
get_undata_nrecords(),
get_undata_update_dates(),
undata_url_to_query()
if (FALSE) { table <- download_undata_table( table_url = "http://data.un.org/Data.aspx?d=POP&f=tableCode:7;areaCode:0&v=1", output_dir = tempdir() ) }