knitr::knit_hooks$set(margin = function(before,options,envir) {
if(before) par(mgp=c(1.5,0.5,0),bty="n",plt=c(.105,.97,.13,.97)) else NULL })

knitr::opts_chunk$set(margin=T,prompt=T,comment="",collapse=T,cache=F,
dev.args=list(pointsize=11),fig.height=3.5,
fig.width=4.24725,fig.retina=2,fig.align="center")

This package contains local human population sizes per geographical pixel for Vietnam. Data are from the WorldPop.

Note that in order to minimize the size of the TIFF files, the data actually contains the populations sizes multiplied by 10,000.

Installation and loading

You can install worldpopVN from GitHub

# install.packages("devtools")
devtools::install_github("choisy/worldpopVN", build_vignettes = TRUE)

Once installed, you can load the package:

library(worldpopVN)

Usage examples

The RasterLayer containing the local human density per pixel can be retrieved with the getpop function:

wpop <- getpop()

It's a RasterLayer object:

wpop

that can be plotted with the plot method:

plot(wpop)

Note that the getpop has 2 arguments year and adjusted. The first one is the year for which we want the population density and can be 2009 (actual census), 2010, 2015 or 2020. By default the year is 2009. The second argument is a logical value and says whether we want the data to be adjusted to match the UN population divisions estimates. This argument cannot be set to TRUE if the year is 2009. Only UN-adjsuted population sizes are available for 2020:

| | adjusted | non-adjusted | |------|:----------:|:--------------:| | 2009 | | x | | 2010 | x | x | | 2015 | x | x | | 2020 | x | |



choisy/worldpopVN documentation built on July 31, 2019, 2:12 p.m.