IniziaInizia gratis

Summarizing a categorical variable

The NHANES variable, Depressed, gives the self-reported frequency in which a participant felt depressed. It is only reported for participants aged 18 years or older. Let's explore the distribution of depression in the US.

Questo esercizio fa parte del corso

Analyzing Survey Data in R

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Specify the survey design
NHANESraw <- mutate(NHANESraw, WTMEC4YR = .5 * WTMEC2YR)
NHANES_design <- svydesign(data = NHANESraw, strata = ~SDMVSTRA, id = ~SDMVPSU, nest = TRUE, weights = ~WTMEC4YR)

# Determine the levels of Depressed
levels(___)
Modifica ed esegui il codice