完形填空问题不显示问题?

时间:2018-10-03 13:51:46

标签: r r-exams

我在用R中的exams包编写完形问题时遇到了麻烦。我试图紧贴boxhist.Rmd的示例,但一定有问题。奇怪的是,在rstudio中编织Rmd可以正常显示所有组件-只是问题的html输出为空白?任何想法表示赞赏!这是我提供给exams:::exams2html的Rmd文件:

```{r data generation, echo = FALSE, results = "hide"}
m = sample(c(-1,0,5),1)
s = sample(c(1,10,20))
x = rnorm(mean = m, sd = s, n = 100)
write.csv(x, file="sumstats.csv",quote = FALSE,row.names = FALSE)
questions <- rep(list(""), 5)
solutions <- rep(list(""), 5)
explanations <- rep(list(""), 5)
type <- rep(list("num"),5)

questions[[1]] <- "What is the Interquartile range of $x$?"
questions[[2]] <- "What is the Variance of $x$?"
questions[[3]] <- "What is the standard deviation of $x$?"
questions[[4]] <- c("The standard deviation is *always* smaller than the variance.","The standard deviation is *NOT always* smaller than the variance.")
questions[[5]] <- "What is the median of $x$?"

solutions[[1]] <- round(IQR(x),3)
solutions[[2]] <- round(var(x),3)
solutions[[3]] <- round(sd(x) ,3)
solutions[[4]] <- mchoice2string(c(FALSE,TRUE))
solutions[[5]] <- round(median(x),3)

type[[4]] <- "schoice"

explanations[[1]] <- "Function `IQR`"
explanations[[2]] <- "Use `var(x)`"
explanations[[3]] <- "`sd(x)`"
explanations[[4]] <- "$\\sqrt{x}$ is not always smaller than $x$. Try $x=0.5$!"
explanations[[5]] <- "`median(x)`"

```

```{r questionlist, echo = FALSE, results = "asis"}
answerlist(unlist(questions), markup = "markdown")
```

Solution
========

```{r solutionlist, echo = FALSE, results = "asis"}
answerlist(paste(unlist(explanations), ".", sep = ""), markup = "markdown")
```



Meta-information
================
extype: cloze
exsolution: `r paste(solutions, collapse = "|")`
exclozetype: `r paste(type, collapse = "|")`
exname: sumstats
extol: 0.05

1 个答案:

答案 0 :(得分:1)

您省略了

Question
========
问题列表前的

标记。实际上,鉴于R / exams不知道问题在哪里,我对此感到很惊讶。

此外,未列出问题的长度(6)需要与未列出解决方案的长度(当前只有5个)匹配。在某些学习管理系统中,可能有必要提供有关各个子项目的反馈。