View source: R/get_pop_query.R
get_pop_query | R Documentation |
This function is a wrapper for the Population Query API. It only allows for querying of one data type (i.e. one of the API endpoints) for a particular town and year.
get_pop_query(token, data_type, planning_area, year, gender = NULL)
token |
User's API token. This can be retrieved using |
data_type |
Type of data to be retrieved, should correspond to one of the API endpoints. E.g. to get economic status data, |
planning_area |
Town for which the data should be retrieved. |
year |
Year for which the data should be retrieved. |
gender |
Optional, valid values include |
A tibble with 1 row and values for all the corresponding variables returned by the API endpoint. If an error occurs, the function will return a NULL value
# output with no NA ## Not run: get_pop_query(token, "getOccupation", "Yishun", "2010") ## Not run: get_pop_query(token, "getModeOfTransportSchool", "Bishan", "2015", "female") # note behaviour with gender parameter not specified ## Not run: get_pop_query(token, "getMaritalStatus", "Bedok", "2010") ## Not run: get_pop_query(token, "getEthnicGroup", "Bedok", "2010") ## Not run: get_pop_query(token, "getPopulationAgeGroup", "Bedok", "2010") # output due to error ## Not run: get_pop_query(token, "getSpokenAtHome", "Bedok", "2043")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.