Package 'wppExplorer'

Title: Explorer of World Population Prospects
Description: Explore data in the 'wpp2019' (or 2017, 2015, ...) package using a 'shiny' interface.
Authors: Hana Sevcikova <[email protected]>
Maintainer: Hana Sevcikova <[email protected]>
License: GPL-3 | file LICENSE
Version: 2.3-4
Built: 2025-02-22 03:24:41 UTC
Source: https://github.com/cran/wppExplorer

Help Index


Explorer of the World Population Prospects

Description

Allows to interactively explore data from the World Population Prospects, contained in packages wpp2019, wpp2017, wpp2015, wpp2012 and wpp2010. It is based on the shiny package.

Details

Package: wppExplorer
Version: 2.3-4
Date: 2020-4-7
Depends: R (>= 3.0.0)
License: GPL-3 | file LICENSE

The main function of the packge is wpp.explore which opens an interactive interface in a web browser. A few helper functions are available for a fast access to the (possibly filtered) data, e.g. wpp.indicator.

The interface can be also accessed online: https://bayespop.shinyapps.io/wpp2019explorer/

Author(s)

Hana Sevcikova <[email protected]>, used code from a Joe Cheng's shiny example

Maintainer: Hana Sevcikova <[email protected]>

Source

The underlying datasets are based on estimates and projections of the United Nations, Department of Economic and Social Affairs, Population Division (2011, 2013, 2015, 2017, 2019). The probabilistic projections were produced with the method of Raftery et al. (2012).

References

World Population Prospects: The 2019 Revision. (https://population.un.org/wpp/) Special Tabulations.

A. E. Raftery, N. Li, H. Sevcikova , P. Gerland, G. K. Heilig (2012). Bayesian probabilistic population projections for all countries. Proceedings of the National Academy of Sciences 109:13915-13921.

P. Gerland, A. E. Raftery, H. Sevcikova, N. Li, D. Gu, T. Spoorenberg, L. Alkema, B. K. Fosdick, J. L. Chunn, N. Lalic, G. Bay, T. Buettner, G. K. Heilig, J. Wilmoth (2014). World Population Stabilization Unlikely This Century. Science 346:234-237.

See Also

wpp2019, wpp2017, wpp2015, wpp2012, wpp2010, shiny, wpp.explore, wpp.indicator


ISO 3166 Dataset

Description

Countries with their alpha-2, alpha-3 and numerical ISO3166-1 code. It includes aggregated regions with user-assigned codes.

Usage

data(iso3166)
	data(iso3166ud)

Format

A data frame containing 5 variables:

name

Country name

charcode

alpha-2 code

charcode3

alpha-3 code

uncode

UN numeric code

is.country

Logical. It is TRUE for all countries included in the official ISO3166-1 dataset and FALSE for user-assigned codes, i.e. aggregations.

Details

Dataset iso3166 includes both, countries and aggregations; dataset iso3166ud includes aggregations only.

References

https://www.iso.org/iso/home/standards/country_codes.htm

Examples

data(iso3166)

Edit/Retrieve WPP Year.

Description

Change/get the WPP year which determines from which wpp package data are retrieved.

Usage

set.wpp.year(wpp.year)

get.wpp.year()

Arguments

wpp.year

Possible values are 2019 (default), 2017, 2015, 2012, and 2010.

Value

get.wpp.year returns the wpp year used through out the package.

Examples

get.wpp.year() # by default the wpp2019 is used
set.wpp.year(2012) # any subsequent operations use the wpp2012 package

Selection by Country and Year

Description

Filtering indicators by given countries and year.

Usage

wpp.by.country(data, country)

wpp.by.countries(data, countries)

wpp.by.year(data, year)

Arguments

data

Data frame as returned by wpp.indicator.

country

alpha-2 ISO 3166 country code.

countries

Vector of alpha-2 ISO 3166 country codes.

year

Year. For vital rates with 5-years time period, currently it is the end year of the time period.

Value

A data frame filtered by the input arguments.

See Also

wpp.indicator

Examples

tfr <- wpp.indicator("fert")
tfr.germany.2010 <- wpp.by.country(wpp.by.year(tfr, 2010), 'DE')

Launching WPP Explorer

Description

Main function of the package. It opens an interactive (shiny) interface in a browser. To exit the browser view, hit the Escape key.

Usage

wpp.explore(wpp.year = NULL, host = NULL, ...)

Arguments

wpp.year

Determines which wpp package is to be explored. Currently available are 2019 (default), 2017, 2015, 2012, and 2010.

host

Argument passed to runApp. Defaults to the shiny.host option, or "0.0.0.0" if not set.

...

Additional arguments passed to runApp.

Details

The time slider in the left pane defines the year or time period for which data are shown. Note that for vital rates indicators, such as fertility, mortality, migration and sex ratio at birth, the time shown on the slider is the end year of the time period of the data shown in the right pane.

The uncertainty selection is only used for indicators and years for which the corresponding lower and upper bounds are available, and for the appropriate visualization types. These are country plots that appear after clicking on the map, table in the “Sortable Data” tab, and “Trends” and “Pyramids”. The 80 and 95% intervals are available for the fertility, life expectancy and total population indicators; The +-1/2child intervals are available for the fertility and population indicators.

The ggplot-based graphs in the Trends and Pyramids tabs are interactive. One can see the data values by mouse hovering or single clicks. One can zoom in by selecting a region. Zooming out is done by a double click.

The interface can be accessed online: https://bayespop.shinyapps.io/wpp2019explorer/

Note

If you have any troubles to see the data, please check that the shiny package is working in your environment. In particular, check that examples in http://rstudio.github.com/shiny/tutorial work. On Windows, you might check this: https://groups.google.com/forum/#!topic/shiny-discuss/tqeURyiPmFI

Author(s)

Hana Sevcikova, based on code from a Joe Cheng's shiny example. Used comments from Patrick Gerland.

See Also

wpp2019, wpp.indicator

Examples

## Not run: 
wpp.explore()
## End(Not run)

Accessing a WPP Indicator

Description

An interface for accessing a WPP indicator, where datasets with observed and predicted data are merged. The resulting data frame is in a "melted" format.

Usage

wpp.indicator(what, ...)

Arguments

what

Name of indicator. Possible values are:

fert

Total fertililty rate. Merges datasets tfr and tfrprojMed.

leF

Female life expectancy. Merges datasets e0F and e0Fproj.

leM

Male life expectancy. Merges datasets e0M and e0Mproj.

tpop

Total population. Uses datasets with age- and sex-specific population counts and agregates over sexes and ages.

tpopF

Total female population. Uses datasets popF and popFprojMed and aggregates over ages.

tpopM

Total male population. Uses datasets popM and popMprojMed and aggregates over ages.

mig

Total net migration. For wpp2019 and wpp2015, the dataset migration is used. For wpp2012 and wpp2010 it aggregates datasets migrationF and migrationM over ages.

migrate

Annual migration rate per thousand population. The denominator is approximated with the average population ((Pt+Pt1)/2(P_{t}+P_{t-1})/2).

popagesex

Population by sex and age. Uses datasets popM and popMprojMed. It requires two arguments in ..., namely sexm=c("F", "M") and
agem=c("0-4", "5-9", ..., "95-99", "100+"). The function aggregates population counts over the given sex and age groups.

mortagesex

Mortality by sex and age. Uses datasets mxF and mxM. It requires two atguments in ..., namely sex which is either "F" or "M", and age which is one of ("0", "1", "5", "10", "15", "20", ... "95", "100+").

fertage

Age-specific fertility rate. Uses datasets tfr and tfrprojMed which are merged together and dataset percentASFR to derive age-specific rates. It requires one argument in ..., namely age which is one of ("15-19", "20-24", ..., "45-49").

pfertage

Percent age-specific fertility. Corresponds to the dataset percentASFR. Argument agem as defined above giving one or more age categories is required.

sexratio

Sex ratio at birth. Corresponds to the dataset sexRatio.

medage

Median age.

meanagechbear

Mean age at childbearing.

meanageinchbearage

Mean age of women in childbearing ages.

tdratio

Total dependency ratio. Ratio of population of age 0 to 14 and 65+ to population of age 15-64.

chdratio

Child dependency ratio. Ratio of population of age 0 to 14 to population of age 15-64.

oadratio

Old-age dependency ratio. Ratio of population of age 65+ to population of age 15-64.

psratio

Potential support ratio. Inverse of old-age dependency ratio.

popgrowth

Average annual population growth (log(Pt/Pt1)/5log(P_t / P_{t-1})/5).

fert.ci, leF.ci, leM.ci, tpop.ci, popagesex.ci

Lower or upper bound of the corresponding indicator. Requires argument which.pi which is one of “80”, “95”, “half.child”, and an argument bound which is either “low” or “high”. Arguments sexm and agem (as defined above, but of length one) are required for popagesex.ci.

...

Arguments passed to the underlying functions as described above.

Value

Data frame with columns charcode (alpha-2 ISO 3166 country code), Year, and value.

Author(s)

Hana Sevcikova

See Also

wpp.by.country, wpp.by.year

Examples

tfr <- wpp.indicator("fert")
	## Not run: 
	# Histogram of TFR 
	print(qplot(value, data=tfr) + facet_wrap(~ Year))
## End(Not run)
	## Not run: 
	mxM01 <- wpp.indicator("mortagesex", sex="M", age="0")
	# Plot map
	plot(gvisGeoMap(tfr, locationvar='charcode', numvar='value'))
## End(Not run)