Use to download NHANES data tables that are in SAS format.
nhanes(
nh_table,
includelabels = FALSE,
translated = TRUE,
cleanse_numeric = FALSE,
nchar = 128,
adjust_timeout = TRUE
)
The table is returned as a data frame.
The name of the specific table to retrieve.
If TRUE, then include SAS labels as variable attribute (default = FALSE).
translated whether the variables are translated.
Logical flag. If TRUE
, some special
codes in numeric variables, such as ‘Refused’ and
‘Don't know’ will be converted to NA
.
Maximum length of translated string (default = 128). Ignored if translated=FALSE.
Typically a logical flag indicating whether
the default download.file
timeout option should be
adjusted by taking into account the size of the file to be
downloaded, as reported by the server. The value can also be a
positive numeric value, in which case it is used as a further
multiplicative factor for the default calculation.
Downloads a table from the NHANES website as is, i.e. in
its entirety with no modification or cleansing. If the
environment variable NHANES_TABLE_BASE
was set during
startup, the value of this variable is used as the base URL
instead of https://wwwn.cdc.gov (this allows the use of a
local or alternative mirror of the CDC data). NHANES tables are
stored in SAS '.XPT' format but are imported as a data frame.
The nhanes
function cannot be used to import limited
access data.
bpx_e = nhanes('BPX_E')
dim(bpx_e)
folate_f = nhanes('FOLATE_F', includelabels = TRUE)
dim(folate_f)
Run the code above in your browser using DataLab