Q1. Let you have five categorical variables 'age', 'sex', 'race', 'education', and 'income' in your data frame called mydat. You labelled these variables as factvars <- c('age', 'sex', 'race', 'education', 'income') and are interested in converting these categorical variables to factors at once. How could you do it in R?
- A. mydat <- lapply(mydat, factvars)
- B. mydat <- lapply(mydat[factvars], as.factor)
- C. mydat[factvars] <- lapply(mydat[factvars], as.factor)
- D. mydat[factvars] <- lapply(mydat, as.factor)
Incorrect. See the `lapply` fuction for deatils. Also, see the 'RHC data' chapter.
Q2. Let we are interested in exploring the relationship between rheumatoid arthritis (binary exposure variable defined as whether the doctor ever told the participant has rheumatoid arthritis) and diabetes (binary outcome variable defined as whether the doctor ever told the participant has diabetes) among US adults using NHANES 2015-16 dataset. What are the PICOT elements in this example:
- A. P: US adults, I: Diabetes, C: No diabetes, O: Rheumatoid arthritis, T: 2015-16
- B. P: US population, I: Rheumatoid arthritis, C: No rheumatoid arthritis, O: Diabetes, T: 2015-16
- C. P: US adults, I: Rheumatoid arthritis, C: No rheumatoid arthritis, O: Diabetes, T: 2015-16
- D. P: US adults, I: Rheumatoid arthritis, C: No rheumatoid arthritis, O: Diabetes, T: 2 years
- E. P: US adults, I: Diabetes, C: No diabetes, O: Rheumatoid arthritis, T: 2 years
- F. P: US population, I: Rheumatoid arthritis, C: No rheumatoid arthritis, O: Diabetes, T: 1 year
Hint: see the 'NHANES data' chapter. Note that P: Population, I: Intervention/exposure, C: Control/unexposed, O: Outcome, T: Time.