```{r setup, warning=FALSE, message=FALSE, include=FALSE}
# Load required packages
library(learnr)
library(xfun)
```

```{r accessing_quiz1, echo=FALSE}
question("Q1. Which is the correct way to access the NHANES 2017-18 data cycle in your RStudio environment?",
  answer("A. Directly download from the CDC website and open it"),
  answer("B. Use R package `nhanesA` to download"),
  answer("C. Both A and B are correct", correct = TRUE),
  answer("D. Neither A nor B is correct"),
  allow_retry = TRUE,
  incorrect = "Hints: The continuous NHANES files are stored on the NHANES website as SAS transport file formats (.xpt). You can import these data files in any statistical software that supports this file format. Some packages are also available to open those data files without downloading them.",
  random_answer_order = FALSE
)
```

```{r accessing_quiz2, echo=FALSE}
question("Q2. Suppose you are interested in exploring whether demographic factors, such as age, sex, and race/ethnicity, are associated with obesity among US adults. To extract the `obesity` information defined as body mass index greater than or equal to 30 kg/m^2 from the NHANES 2017-18 cycle, which data file do you need to access?",
  answer("DEMO_J", message = "Hints: CDC uses a file name to characterize a type of data file"),
  answer("BMX_H", message = "Hints: CDC uses an index number to characterize each cycle"),
  answer("BMX_J", correct = TRUE),
  answer("DBQ_H", message = "Hints: CDC uses an index number to characterize each cycle"),
  allow_retry = TRUE,
  random_answer_order = TRUE
)
```

```{r accessing_quiz3, echo=FALSE}
question("Q3. In Q2, what is the name of the variable age at screening in years?",
  answer("DMDHRAGZ"),
  answer("RIDAGEMN"),
  answer("RIDAGEYR", correct = TRUE),
  answer("RHD018"),
  allow_retry = TRUE,
  incorrect = "Incorrect. There are many age variables in NHANES. Check the appropriate one for your analysis.",
  random_answer_order = TRUE
)
```

```{r accessing_quiz4, echo=FALSE}
question("Q4. In Q2, what is the name of the unique identifier number?",
  answer("Studyid"),
  answer("ID"),
  answer("SEQN", correct = TRUE),
  answer("SDDSRVYR"),
  answer("DEMO"),
  allow_retry = TRUE,
  incorrect = "Hints: All files have this unique identifier number so that one can merge multiple data files based on that number.",
  random_answer_order = TRUE
)
```
