readJMDweb | R Documentation |
JMD data are formatted exactly as HMD data. This function simply parses the necessary url together given a prefecture code and data item (same nomenclature as HMD). Data is parsed using HMDparse()
, which converts columns into useful and intuitive classes, for ready-use. See ?HMDparse
for more information on type conversions. No authentication is required for this database. Only a single item/prefecture is downloaded. Loop for more complex calls (See examples). The prefID is not appended as a column, so be mindful of this if appending several items together into a single data.frame
. Note that at the time of this writing, the finest Lexis resolution for prefectural lifetables is 5x5 (5-year, 5-year age groups). Raw data are, however, provided in 1x1 format, and deaths are also available in triangles.
readJMDweb(prefID = "01", item = "Deaths_5x5", fixup = TRUE, ...)
prefID |
a single prefID 2-digit character string, ranging from |
item |
the statistical product you want, e.g., |
fixup |
logical. Should columns be made more user-friendly, e.g., forcing Age to be integer? |
... |
extra arguments ultimately passed to |
No details of note. This database in independently maintained, so file types/locations are subject to change. If this happens, please notify the package maintainer.
data.frame
of the data item is invisibly returned
## Not run:
library(HMDHFDplus)
# grab prefecture codes (including All Japan)
prefectures <- getJMDprefectures()
# grab all mltper_5x5
# and stick into long data.frame:
mltper <- do.call(rbind, lapply(prefectures, function(prefID){
Dat <- readJMDweb(prefID = prefID, item = "mltper_5x5", fixup = TRUE)
Dat$PrefID <- prefID
Dat
}))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.