selectHMDdata: Selecting Data from the HMDdata Object

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/selectHMDdata.R

Description

Creates subset of the HMDdata object.

Usage

1
2
3
4
selectHMDdata(country,
              data = c("Population", "Deaths", "Exposures", "Rates"), 
              sex = c("Females", "Males", "Total"), 
              ages = NULL, years = NULL)

Arguments

country

character string for the country name.

data

character string showing type of demographic series: either "Population", "Deaths", "Exposures" or "Rates". Default value "Population".

sex

character string showing sex of demographic series: either "Females", "Males" or "Total". Default value "Females".

ages

vector of ages to extract from data. If it is NULL, all ages will be selected.

years

vector of years to extract from data. If it is NULL, all available years will be selected.

Details

HMDdata are loaded with the package.

Country names is not case-sensitive and initials can be used. However, distinguishable country name is necessary. Type of data and sex are case-sensitive and initials can be used.

Available ages are always from 0 to 110, whereas years depends on the country. Warning massages will be provided in case of selected default values. Attributes about country, data and sex will be given to the outcome.

Value

Matrix object from HMDdata with a subset of country, type of data, sex, ages and years.

Author(s)

Carlo G Camarda

References

Camarda, C. G. (2012). MortalitySmooth: An R Package for Smoothing Poisson Counts with P-Splines. Journal of Statistical Software. 50, 1-24. http://www.jstatsoft.org/v50/i01/.

See Also

HMDdata.

Examples

1
2
3
4
5
6
7
8
9
## "Complete" example
x <- 1950:2000
den50 <- selectHMDdata("Denmark", "Death", "Females", 50, x)
plot(x, den50, main="Danish female deaths at age 50")
## "Incomplete" example with warning
jap50 <- selectHMDdata("jap", "Pop", "F", 50)
## Wrong example (don't run)
## selectHMDdata("Sw", "Pop", "F", 50, 2000)
## Sw can stand for both Sweden and Switzerland

MortalitySmooth documentation built on May 29, 2017, 7:11 p.m.