Version: | 2.3-4 |
Date: | 2020-4-7 |
Title: | Explorer of World Population Prospects |
Author: | Hana Sevcikova <hanas@uw.edu> |
Maintainer: | Hana Sevcikova <hanas@uw.edu> |
Depends: | R (≥ 3.0.0) |
Imports: | shiny (≥ 0.13.0), shinythemes, shinyjs, plyr, reshape2, googleVis, wpp2019, Hmisc, ggplot2, DT |
Suggests: | wpp2017, wpp2015, wpp2012, wpp2010, testthat |
Description: | Explore data in the 'wpp2019' (or 2017, 2015, ...) package using a 'shiny' interface. |
License: | GPL-3 | file LICENSE |
NeedsCompilation: | no |
Packaged: | 2020-04-07 18:58:28 UTC; hana |
Repository: | CRAN |
Date/Publication: | 2020-04-09 09:10:02 UTC |
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 <hanas@uw.edu>, used code from a Joe Cheng's shiny example
Maintainer: Hana Sevcikova <hanas@uw.edu>
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 andFALSE
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 |
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
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 |
... |
Additional arguments passed to |
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
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:
|
... |
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
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)