nhanesFromURL {nhanesA} | R Documentation |
Download NHANES table from URL
Description
Downloads an NHANES table from a URL and returns it as a data frame.
Usage
nhanesFromURL(
url,
translated = TRUE,
cleanse_numeric = TRUE,
nchar = 128,
adjust_timeout = TRUE
)
Arguments
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 |
Details
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).
Value
A data frame containing the data in the XPT file avalable at the URL.
Examples
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)