getWPdownload: Download a dataset from the WorldPopUK site

Description Usage Arguments Author(s) References Examples

Description

This function downloads a dataset in .tif format from the WorldPopUK

This function is intended to be used following the getWPdatatypes() and getWPoptions() functions as the inputs for getWPdownload() are given by the previous two functions.

As a bonus and to make matching WorldPop sets easier, this function contains correction algorithms to standardize country names to match WorldPop UK sets (i.e. WorldPop has "Côte d'Ivoire", you can type "Ivory Coast" and it will return the WorldPop Côte d'Ivoire set). This function adds a dataframe of the available sets called WP.options to your working environment.

Usage

1
getWPdownload(countryname, datatype, options, year)

Arguments

countryname

(character), the name of a country you want to see what data is avaialble from WorldPop for. e.g. “Tanzania”

datatype

(character), the datatype you would like to see what options are available for WorldPop UK data. The available datatypes can be attained with the function getWPdatatypes() Example datatypes: “Population” or “Stunting”

options

(character), the options of the tif dataset you would like to download. The available options can be attained with the function getWPoptions() e.g. “ppp” or c(“F”, "interdecile")

year

(numeric), the year of the dataset you would like to download. Available years are given by the getWPoptions() function.

If a dataset on WorldPop is not year coded in the filename you will need to type 9999 for the year. This is indicated by the getWPoptions() function. e.g. 2015 or 9999

Author(s)

Neal Thomas Barsch

References

WorldPop UK data are attained through the WorldPop UK website. These data are licensensed under the Creative Commons Attribution 4.0 License. http://www.worldpop.org.uk/.

Eternal grattitude to StackOverflow member hrbrmstr without whom this function would not have been possible.

Examples

 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
getWPdownload("Tanzania", "Births", "pp", 2015)

#Example that has year 9999 and multiple options
getWPdownload("Nigeria", "Stunting", c("F", "interdecile"), 9999)

###FULL EXAMPLES###

###Full Example 1###
#see available Tanzania sets
getWPdatatypes("Tanzania")

#see available options for Tanzania Births Set
getWPoptions("Tanzania", "Births")

#Download as above with included options
getWPdownload("Tanzania", "Births", "pp", 2015)

###Full Example 2###
getWPdatatypes("Nigeria")

#see available options for Nigeria Stunting Set
getWPoptions("Nigeria", "Stunting")

#Download as above with included options for uncertainty map
getWPdownload("Nigeria", "Stunting", c("F", "interdecile"), 9999)

#or for the dataset NOT the uncertainty map
getWPdownload("Nigeria", "Stunting", "F", 9999)

nbarsch/spaceheater documentation built on Sept. 3, 2021, 6:13 a.m.