我想用learnr
文件夹中的文件在RMarkdown中创建一个responses
教程,其中包含问题,视频和测验的数据。
我在responses
文件夹中有三个csv文件:
[1] "responses/20181109-163432_question.csv" "responses/20181109-163437_video.csv"
[3] "responses/20181109-163442_quiz.csv"
在learnr
R降价中,使用YAML:
title: "Create Question/Video/Quiz"
output:
learnr::tutorial:
progressive: true
allow_skip: true
runtime: shiny_prerendered
我想遍历这些文件,如果是question
文件,请创建问题模板,如果是video
,请创建视频模板,如果是quiz
,请创建测验模板
我说的模板是指learnr
函数:
question
模板为:
```{r letter-a, echo=FALSE}
question("What number is the letter A in the English alphabet?",
answer("8"),
answer("14"),
answer("1", correct = TRUE),
answer("23"),
random_answer_order = TRUE
)
```
视频模板为:
```{r}
# Video Title
![](https://youtu.be/zNzZ1PfUDNk){width="90%"}
```
测验模板为:
``{r quiz1, echo=FALSE}
quiz(caption = "Quiz 1",
question("What number is the letter A in the *English* alphabet?",
answer("8"),
answer("14"),
answer("1", correct = TRUE),
answer("23")
),
question("Where are you right now? (select ALL that apply)",
answer("Planet Earth", correct = TRUE),
answer("Pluto"),
answer("At a computing device", correct = TRUE),
answer("In the Milky Way", correct = TRUE),
incorrect = "Incorrect. You're on Earth, in the Milky Way, at a computer."
)
)
```
注意:这些模板取自learnr
tutorial