Description Usage Arguments Details Value Author(s) Source See Also Examples
Obtain data from the Human Mortality Database (HMD) maintained at the
University of California at Berkeley and the Max Planck Institute for
Demographic Research. To use readHMD
, you must first obtain a
username
and password
from HMD and supply them as
arguments to this function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | readHMD(username, password,
country=c(AUS='Australia', AUT='Austria', BLR='Belarus',
BEL='Belgium', BGR='Bulgaria', CAN='Canada',
CHL='Chile', CZE='Czech Republic', DNK='Denmark',
EST='Estonia', FIN='Finland', FRA='France',
DEU='Germany', HUN='Hungary', ISL='Iceland',
IRL='Ireland', ISR='Israel', ITA='Italy',
JPN='Japan', LVA='Latvia', LTU='Lithuania',
LUX='Luxemburg', NDL='Netherlands', NZL='New Zealand',
NOR='Norway', POL='Poland', PRT='Portugal',
RUS='Russia', SVK='Slovakia', SVN='Slovenia',
ESP='Spain', SWE='Sweden', CHE='Switzerland',
TWN='Taiwan', GBR='U.K.', USA='U.S.A.',
UKR='Ukraine'),
sex=c('m', 'f', 'b'), HMDurl='http://www.mortality.org/hmd',
dataType = 'lt',
ltCol=c('m', 'q', 'a', 'l', 'd', 'L', 'T', 'e'),
cohper = c(coh='cohort', per='periodic'),
ageInterval=c(1, 5), yearInterval=c(1, 5, 10),
url, ...)
|
username, password |
user name and password for HMD. |
country |
country for which data are required. Must be one of the available options given with the "usage", specified either by the name of the 3-letter code. |
sex |
gender for which data are required (male, female or both), specified via a single letter. |
HMDurl |
character string giving the URL of HMD. |
dataType |
data type: 'lt' for 'life table'. If a different data type is
required, you should go to the HMD web site, find the URL you want,
and specify it directly via the |
ltCol |
life table column:
|
cohper |
periodic or chorhort data? |
ageInterval |
width of the age intervals: either 1 or 5 years. |
yearInterval |
width of the intervals for which results are desired: either, 1, 5 or 10 years. |
url |
The Universal Resource Locator for the desired table. If provided,
all the other arguments except |
... |
options arguments for |
To use this function, you need a username and password with HMD. As of 2012.07.28, the HMD access is free for individuals, but you must register with them. To start the registration process, go to http://www.mortality.org and click "New User" near the top in the left margin. Then click "New User" again to see the User Agreement.
In all published work and presentations, please acknowledge the HMD as either the source or the intermediary of the data with the date on which you extracted the data. See http://www.mortality.org/mp/auth.pl for recommended citation formats.
If you agree to comply with their User Agreement, click "I agree" at the bottom of that page. This will take you to another page where you can enter requested information about you including an email address to which your password will be mailed.
If url is provided or dataType != 'lt' or read.table
fails, this returns a list with the following components:
URL |
the URL that was used, being the argument |
getURL |
object returned by |
readLines |
object returned by readLines(getURL(...)). |
read.table |
object returned by read.table(getURL(...)). |
Otherwise, this returns a list with the following components:
x |
numeric vector of ages |
y |
matrix of the data for each age-year combination |
time |
numeric vector of the years |
xname |
"age" |
yname |
c(m='Mortality rate', q='Mortality probability', a='Survival time for mortalities', l='Number of survivors', d='Number of deaths', L='Person-years in interval', T='Person-years remaining', e='Life expectancy')[ltCol] = data type from the life table |
class |
c('fts', 'fds') |
Han Lin Shang, Monash University in Australia, and Spencer Graves
Human Mortality Database. University of California, Berkeley (USA), and Max Planck Institute for Demographic Research (Germany). Available at www.mortality.org and www.humanmortality.de.
1 2 3 4 5 6 7 8 9 | ## Not run:
user <- "your.email@wherever.org" # as registered with HMD.
pw <- "1234567890"
# password as provided in an email from HMD possibly changed by you.
country <- 'Sweden'
SwedeMatAll <- readHMD(user, pw, 'Sweden', sex='f')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.