nhanesFromURL | R Documentation |
Downloads an NHANES table from a URL and returns it as a data frame.
nhanesFromURL(
url,
translated = TRUE,
cleanse_numeric = TRUE,
nchar = 128,
adjust_timeout = TRUE
)
url |
URL of XPT file to be downloaded. |
translated |
logical, whether variable codes should be translated |
cleanse_numeric |
Logical flag. If |
nchar |
integer, labels are truncated after this |
adjust_timeout |
Typically a logical flag indicating whether
the default |
This function downloads a table from the NHANES website using its
URL. It is similar to nhanes
, except that it
requires the URL to be explicitly specified, and does not try to
infer it from the table name. It also performs some limited
cleansing of the data by default.
The URL may be completely specified, but the initial standard
prefix "https://wwwn.cdc.gov"
may be optionally
dropped. More precisely, if the URL starts with "/nchs/"
,
then the prefix is automatically added. It is possible to override
the default prefix by setting the environment variable
NHANES_TABLE_BASE
(this allows the use of a local or
alternative mirror of the CDC data).
A data frame containing the data in the XPT file avalable at the URL.
vix_e = nhanesFromURL("https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2007/DataFiles/VIX_E.xpt")
bpx_e = nhanesFromURL("/Nchs/Data/Nhanes/Public/2007/DataFiles/BPX_E.xpt", translated = FALSE)
dim(bpx_e)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.