Skip to content
RDocumentation: NHANES
Note that this notebook was automatically generated from an RDocumentation page. It depends on the package and the example code whether this code will run without errors. You may need to edit the code to make things work.
if(!require('NHANES')) {
install.packages('NHANES')
library('NHANES')
}# Due to the sampling design, some races were over/under-sampled.
rbind(
NHANES = table(NHANES$Race1) / nrow(NHANES),
NHANESraw = table(NHANESraw$Race1) / nrow(NHANESraw),
diff = (table(NHANES$Race1) - table(NHANESraw$Race1)) / nrow(NHANESraw)
)
# SmokeNow is only asked of people who answer Yes to Smoke100
if (require(mosaic)) {
nhanes <-
NHANES %>%
mutate(
SmokingStatus = derivedFactor(
Current = SmokeNow == "Yes",
Former = SmokeNow == "No",
Never = Smoke100 == "No"
)
)
tally( ~SmokingStatus, data = nhanes )
}