Skip to content

Instantly share code, notes, and snippets.

@kenjisato
Created July 24, 2020 00:46
Show Gist options
  • Save kenjisato/5cf9b96e4102790de205ab9a5e7f60b5 to your computer and use it in GitHub Desktop.
Save kenjisato/5cf9b96e4102790de205ab9a5e7f60b5 to your computer and use it in GitHub Desktop.
```{r}
N <- 3
mountains <-
data.frame(
Mountain = c("Everest", "K2", "Kangchenjunga", "Lhotse", "Makalu",
"Cho Oyu", "Dhaulagiri", "Manaslu"),
`Height (m)` = c(8848, 8611, 8586, 8516, 8485, 8188, 8167, 8163),
check.names = FALSE
)
choice <- sample(nrow(mountains), N)
table <- mountains[choice, ]
table$`Height (m)` <- paste0("\\##ANSWER", seq_len(N), "##")
```
Question
========
```{r CSS, echo = FALSE, results = "asis"}
writeLines(readLines("https://git.io/JJ8iW"))
```
How high are the following mountains? Answer the height above sea level in meters.
```{r question, echo = FALSE, results = "asis"}
knitr::kable(table, format = "html",
table.attr='class="bordered-table"',
align = "lr",
row.names = FALSE)
```
Solution
========
```{r solution, echo = FALSE, results = "asis"}
knitr::kable(mountains[choice, ], format = "html",
table.attr = 'class="bordered-table"',
row.names = FALSE)
```
Meta-information
================
extype: cloze
exsolution: `r paste(mountains[choice, "Height (m)"], collapse = "|")`
exclozetype: `r paste(rep("num", 3), collapse = "|")`
exname: bordered-table
extol: 0
exextra[numwidth,logical]: TRUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment