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 |
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.
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/
Hana Sevcikova <[email protected]>, used code from a Joe Cheng's shiny example
Maintainer: Hana Sevcikova <[email protected]>
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).
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.
wpp2019
, wpp2017
, wpp2015
, wpp2012
, wpp2010
, shiny
, wpp.explore
, wpp.indicator
Countries with their alpha-2, alpha-3 and numerical ISO3166-1 code. It includes aggregated regions with user-assigned codes.
data(iso3166) data(iso3166ud)
data(iso3166) data(iso3166ud)
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.
Dataset iso3166
includes both, countries and aggregations; dataset iso3166ud
includes aggregations only.
https://www.iso.org/iso/home/standards/country_codes.htm
data(iso3166)
data(iso3166)
Change/get the WPP year which determines from which wpp package data are retrieved.
set.wpp.year(wpp.year) get.wpp.year()
set.wpp.year(wpp.year) get.wpp.year()
wpp.year |
Possible values are 2019 (default), 2017, 2015, 2012, and 2010. |
get.wpp.year
returns the wpp year used through out the package.
get.wpp.year() # by default the wpp2019 is used set.wpp.year(2012) # any subsequent operations use the wpp2012 package
get.wpp.year() # by default the wpp2019 is used set.wpp.year(2012) # any subsequent operations use the wpp2012 package
Filtering indicators by given countries and year.
wpp.by.country(data, country) wpp.by.countries(data, countries) wpp.by.year(data, year)
wpp.by.country(data, country) wpp.by.countries(data, countries) wpp.by.year(data, year)
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. |
A data frame filtered by the input arguments.
tfr <- wpp.indicator("fert") tfr.germany.2010 <- wpp.by.country(wpp.by.year(tfr, 2010), 'DE')
tfr <- wpp.indicator("fert") tfr.germany.2010 <- wpp.by.country(wpp.by.year(tfr, 2010), 'DE')
Main function of the package. It opens an interactive (shiny) interface in a browser. To exit the browser view, hit the Escape key.
wpp.explore(wpp.year = NULL, host = NULL, ...)
wpp.explore(wpp.year = NULL, host = NULL, ...)
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 |
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/
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
Hana Sevcikova, based on code from a Joe Cheng's shiny example. Used comments from Patrick Gerland.
## Not run: wpp.explore() ## End(Not run)
## Not run: wpp.explore() ## End(Not run)
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.
wpp.indicator(what, ...)
wpp.indicator(what, ...)
what |
Name of indicator. Possible values are:
|
... |
Arguments passed to the underlying functions as described above. |
Data frame with columns charcode
(alpha-2 ISO 3166 country code), Year
, and value
.
Hana Sevcikova
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)
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)