Description Usage Arguments Details Examples
API Link Generator Function
1 2 3 4 5 6 | linkGenerator(
server = getOption("unpd_server", "https://popdiv.dfs.un.org/DemoData/api/"),
type,
verbose,
...
)
|
server |
The path to the database. Check if the "unpd_server" option is
is set. If not, defaults to |
type |
Type of data. Various options are available. |
verbose |
Logical for whether to print the final translated call to numeric arguments. If the translation of arguments take a lot of time, it can have a substantial reduction in timing. This only makes sense if the user provided values as strings which need translation (such as a country name like 'Haiti' rather than its actually country code). |
... |
Other arguments that might define the path to data. All arguments accept a numeric code which is interpreted as the code of the specific product requested. Alternatively, you can supply the equivalent product name as a string which is case insensitive (see examples). Handle with care, this is important! For a list of all options available, see the parameters for each endpoint at https://popdiv.dfs.un.org/Demodata/swagger/ui/index#/ |
The link generator is based on the structure of the database created by Dennis Butler (in late 2018). To change the server used to make the requests, set this at the beginning of your script: options(unpd_server = "fill this out").
When requesting data from the structured data format (usually called from
get_recorddata
), the columns TimeStart
and TimeEnd
are returned with format DD/MM/YYYY
, where DD
are days, MM
are months and YYYY
are years.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Not run:
# Link to country list
L1 <- linkGenerator(
type = "locations",
addDefault = "false",
includeDependencies = "false",
includeFormerCountries = "false"
)
L1
# Link to location types (for Egypt)
# With strings rather than codes
L2 <- linkGenerator(
type = "locAreaTypes",
indicatorTypeIds = "Population by sex",
locIds = "Egypt",
isComplete = "Abridged"
)
L2
# Link to subgroup types (for Egypt)
L3 <- linkGenerator(
type = "subGroups",
indicatorTypeIds = 8,
locIds = 818,
isComplete = 0
)
L3
# Link to indicator list
L4 <- linkGenerator(
type = "indicators",
addDefault = "false"
)
L4
# Link to data process type list
L5 <- linkGenerator(type = "dataProcessTypes")
L5
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.