Description Usage Arguments Value Examples
View source: R/create_datasets.R
Load selected NHANES files for a specific year
| 1 | load_nhanes(f = "", yr, data_dir = "./data", lab = FALSE)
 | 
| f | = nhanes file (no suffix – just main file code like "mcq" and not "mcq_f" or "mcq_f.rds") | 
| yr | = first year of wave, | 
| data_dir | = The directory in which all of your NHANES subdirectories (one for each year) reside. Default is the project "data" subdirectory (i.e., "./data") but if your data are elsewhere, you must specify the directory. Keep in mind that this will be a directory that contains all of your NHANES subdirectories. It is NOT the subdirectory for a specific year. Do not use a slash (/) at the end. | 
| lab | = indicator of whether the label file should be included (if FALSE, then data file will be retrieved) | 
Returns a dataframe (a data.table) with the requested file. This function can be used as a stand-alone function to get a single file, or it can be used with the load_merge function to do multiple files
| 1 2 3 4 5 6 7 8 9 10 | ## Not run: 
Load single data files
demographics <- load_nhanes("demo", 2003)
med_cond_ques <- load_nhanes("mcq", 2009)
# Load single label files
demographics_labels <- load_nhanes("demo", 2003, lab = TRUE)
med_cond_ques_labels <- load_nhanes("mcq", 2009, lab = TRUE)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.