Learn R Programming

socialmixr (version 0.5.0)

survey_country_population: Get survey country population data

Description

Looks up the country and year inside a survey, or a provided "countries" value, and determines the corresponding demographics in the world population prospects data using wpp_age().

Usage

survey_country_population(survey, countries = NULL)

Value

A data table with population data by age group for the survey countries, aggregated by lower age limit. The function will error if no country information is available from either the survey or countries argument.

Arguments

survey

A survey() object, with column "country" in "participants".

countries

Optional. A character vector of country names. If specified, this will be used instead of the potential "country" column in "participants".

Examples

Run this code
survey_country_population(polymod)
survey_country_population(polymod, countries = "Belgium")
survey_country_population(polymod, countries = c("Belgium", "Italy"))

Run the code above in your browser using DataLab