Title: | Wrapper for 'TCdata360' and 'Govdata360' API |
---|---|
Description: | Makes it easy to engage with the Application Program Interface (API) of the 'TCdata360' and 'Govdata360' platforms at <https://tcdata360.worldbank.org/> and <https://govdata360.worldbank.org/>, respectively. These application program interfaces provide access to over 5000 trade, competitiveness, and governance indicator data, metadata, and related information from sources both inside and outside the World Bank Group. Package functions include easier download of data sets, metadata, and related information, as well as searching based on user-inputted query. |
Authors: | Ramin Aliyev [cre], Ma. Regina Paz Onglao-Drilon [aut], World Bank Group [cph] |
Maintainer: | Ramin Aliyev <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.9 |
Built: | 2025-02-18 04:41:07 UTC |
Source: | https://github.com/pechiyappan/data360r |
Downloads the requested data by using the TCdata360 API at https://tcdata360.worldbank.org/docs or Govdata360 API at https://govdata360.worldbank.org/docs. The function generates a data frame (wide or long, depending on user input).
get_data360( site = "tc", indicator_id = NULL, dataset_id = NULL, country_iso3 = NULL, timeframes = NULL, output_type = "wide" )
get_data360( site = "tc", indicator_id = NULL, dataset_id = NULL, country_iso3 = NULL, timeframes = NULL, output_type = "wide" )
site |
string pertaining to the data360 site to download data from. Possible choices: 'tc' for TCdata360, 'gov' for Govdata360 |
indicator_id |
NULL (optional); Vector of indicators codes.
Should be left NULL if |
dataset_id |
NULL (optional); Character vector of Dataset IDs for all indicator data is to be downloaded.
Should be left NULL if |
country_iso3 |
defaults to c('USA', 'PNG', 'PHL') (optional); Vector of countries (ISO-3 3-letter character codes, e.g. 'PNG', 'USA', 'PHL') for which the data is needed. Leaving this NULL pulls data for every available country. |
timeframes |
NULL (optional); Vector of years to restrict results data to.
Leaving this NULL gets all available timeframes.
Important note: |
output_type |
string pertaining to the output type. Possible choices include: 'wide' == one row contains multi-year observations 'long' == one row refers to one year only. |
Hint: Don't know what codes to write as inputs for this function? Helpful functions include:
See search_360
to get search TC/Govdata360 indicators, countries, categories, and dataset lists.
See get_metadata360
to get indicator/dataset/country-level metadata.
See get_resources360
to get additional resource information.
Data frame containing requested data
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get data for dataset ID 51 in TCdata360 df <- get_data360(dataset_id = 51) #get data for countries USA, PHL in Govdata360 df2 <- get_data360(site = 'gov', country_iso3 = c('USA', 'PHL')) #get data for indicator IDs 944, 972 in TCdata360 df3 <- get_data360(indicator_id = c(944, 972)) #get data for indicator IDs 944, 972 in 2011-2013 in long format in TCdata360 df4 <- get_data360(indicator_id = c(944, 972), timeframes = c(2011, 2012), output_type = 'long')
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get data for dataset ID 51 in TCdata360 df <- get_data360(dataset_id = 51) #get data for countries USA, PHL in Govdata360 df2 <- get_data360(site = 'gov', country_iso3 = c('USA', 'PHL')) #get data for indicator IDs 944, 972 in TCdata360 df3 <- get_data360(indicator_id = c(944, 972)) #get data for indicator IDs 944, 972 in 2011-2013 in long format in TCdata360 df4 <- get_data360(indicator_id = c(944, 972), timeframes = c(2011, 2012), output_type = 'long')
Downloads the requested metadata by using the TCdata360 API at https://tcdata360.worldbank.org/docs or Govdata360 API at https://govdata360.worldbank.org/docs. The function generates a wide dataframe.
get_metadata360(site = "tc", metadata_type = "countries")
get_metadata360(site = "tc", metadata_type = "countries")
site |
string pertaining to the data360 site to download data from. Possible choices: 'tc' for TCdata360, 'gov' for Govdata360 |
metadata_type |
string pertaining to the metadata to be downloaded. Possible choices: 'countries' == Lists metadata for all countries and regions. 'indicators' == Lists metadata for all indicators. Does not return actual data. 'datasets' == Lists metadata for all datasets. |
Hint: Want to get other data? Helpful functions include:
See search_360
to get search TC/Govdata360 indicators, countries, categories, and dataset lists.
See get_data360
to get actual indicator/dataset/country-level data.
See get_resources360
to get additional resource information.
Data frame (wide) containing requested metadata
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get all indicator metadata in Govdata360 df_indicators <- get_metadata360(site="gov", metadata_type = "indicators") #get all country metadata in TCdata360 df_countries <- get_metadata360(metadata_type = 'countries') #get all dataset metadata in TCdata360 df_datasets <- get_metadata360(metadata_type = 'datasets')
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get all indicator metadata in Govdata360 df_indicators <- get_metadata360(site="gov", metadata_type = "indicators") #get all country metadata in TCdata360 df_countries <- get_metadata360(metadata_type = 'countries') #get all dataset metadata in TCdata360 df_datasets <- get_metadata360(metadata_type = 'datasets')
Downloads the requested resource information by using the TCdata360 API at https://tcdata360.worldbank.org/docs or Govdata360 API at https://govdata360.worldbank.org/docs. The function generates a wide dataframe containing resource information.
get_resources360(site = "tc", resource_type = "nav")
get_resources360(site = "tc", resource_type = "nav")
site |
string pertaining to the data360 site to download data from. Possible choices: 'tc' for TCdata360, 'gov' for Govdata360 |
resource_type |
string pertaining to the metadata to be downloaded. Possible choices: 'related' == Find WBG content related to certain topics and countries. Note that this endpoint calls a number of external API so may take around 10s to return on the initial call, however after this the response will be cached. 'toolkits' == Find WBG toolkits related to certain topics and subtopics. 'nav' == List root categories in navigational hierarchy. |
Hint: Want to get other data? Helpful functions include:
See search_360
to get search TC/Govdata360 indicators, countries, categories, and dataset lists.
See get_data360
to get actual indicator/dataset/country-level data.
See get_metadata360
to get indicator/dataset/country-level metadata.
Data frame (wide) containing requested resource information
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get all root-level categories in TCdata360 df_nav <- get_resources360() #get all toolkits from Govdata360 df_toolkits <- get_resources360(site='gov', resource_type = 'toolkits')
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #get all root-level categories in TCdata360 df_nav <- get_resources360() #get all toolkits from Govdata360 df_toolkits <- get_resources360(site='gov', resource_type = 'toolkits')
Searches using the TCdata360 API at https://tcdata360.worldbank.org/docs or Govdata360 API at https://govdata360.worldbank.org/docs. The function generates a wide dataframe containing the top search results related to the query.
search_360( search_string = "World Bank", site = "tc", search_type = NULL, limit_results = NULL )
search_360( search_string = "World Bank", site = "tc", search_type = NULL, limit_results = NULL )
search_string |
string to query in TC/Govdata360 |
site |
string pertaining to the data360 site to download data from. Possible choices: 'tc' for TCdata360, 'gov' for Govdata360 |
search_type |
NULL (optional). Character vector of search types to include. Possible values include: 'indicator', 'category', 'country' Leaving this NULL will return all possible search results. |
limit_results |
NULL (optional). Number pertaining to the number of top results to be kept. |
Hint: Want to use your search results to call data? Helpful functions include:
See get_data360
to get actual indicator/dataset/country-level data.
See get_metadata360
to get indicator/dataset/country-level metadata.
See get_resources360
to get additional resource information.
List containing top search results
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #search a country's code in TCdata360 search_360('Philippines', search_type = 'country') #search for top 10 relevant indicator codes in TCdata360 search_360('GDP', search_type = 'indicator', limit_results = 10) #search for top 10 indicators of a database in TCdata360 search_360('World Development Indicators', search_type = 'indicator', limit_results = 10) #search for top 10 indicators of a data provider in TCdata360 search_360('WEF', search_type = 'indicator', limit_results = 10) #search for top 10 relevant categories in Govdata360 search_360('Governance', site='gov', search_type = 'category', limit_results = 10)
## Since all functions download data through API, these are wrapped with ## the "donttest" function as advised by CRAN #search a country's code in TCdata360 search_360('Philippines', search_type = 'country') #search for top 10 relevant indicator codes in TCdata360 search_360('GDP', search_type = 'indicator', limit_results = 10) #search for top 10 indicators of a database in TCdata360 search_360('World Development Indicators', search_type = 'indicator', limit_results = 10) #search for top 10 indicators of a data provider in TCdata360 search_360('WEF', search_type = 'indicator', limit_results = 10) #search for top 10 relevant categories in Govdata360 search_360('Governance', site='gov', search_type = 'category', limit_results = 10)