R package for accessing and analyzing CDC NHANES data
R
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
R
data-raw
man
tests
vignettes
.Rbuildignore
.gitattributes
.gitignore
.travis.yml
DESCRIPTION
LICENSE
NAMESPACE
NEWS.md
README.md
cran-comments.md

README.md

RNHANES

RNHANES is an R package for accessing and analyzing CDC NHANES data that was developed by Silent Spring Institute.

CRAN Version Build Status codecov.io

Demo of RNHANES

Features

  • Download and search NHANES variable and data file lists
  • Download and cache NHANES data files
  • Compute sample sizes, detection frequencies, quantiles, and covariance matrices
  • Plot weighted histograms

Install

You can install the latest stable version through CRAN:

install.packages("RNHANES")

Or you can install the latest development version from github:

library(devtools)

install_github("silentspringinstitute/RNHANES")

Examples

library(RNHANES)

# Download environmental phenols & parabens data from the 2011-2012 survey cycle
dat <- nhanes_load_data("EPH", "2011-2012")

# Download the same data, but this time include demographics data (which includes sample weights)
dat <- nhanes_load_data("EPH", "2011-2012", demographics = TRUE)

# Find the sample size for urinary triclosan
nhanes_sample_size(dat,
  column = "URXTRS",
  comment_column = "URDTRSLC",
  weights_column = "WTSA2YR")

# Compute the detection frequency of urinary triclosan
nhanes_detection_frequency(dat,
  column = "URXTRS",
  comment_column = "URDTRSLC",
  weights_column = "WTSA2YR")

# Compute 95th and 99th quantiles for urinary triclosan
nhanes_quantile(dat,
  column = "URXTRS",
  comment_column = "URDTRSLC",
  weights_column = "WTSA2YR",
  quantiles = c(0.95, 0.99))

# Plot a histogram of the urinary triclosan distribution
nhanes_hist(dat,
  column = "URXTRS",
  comment_column = "URDTRSLC",
  weights_column = "WTSA2YR")

# Build a survey design object for use with survey package
design <- nhanes_survey_design(dat, weights_column = "WTSA2YR")