0

我在用examsR 中的包写完形填空问题时遇到了麻烦。我试图贴近这个boxhist.Rmd例子,但一定有问题。奇怪的是,在 rstudio 中编织 Rmd 可以显示所有组件 - 只是 html 输出对于问题来说是空白的?任何想法都非常感谢!这是我的 Rmd 文件,我将其提供给exams:::exams2html

```{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
4

1 回答 1

1

你省略了

Question
========

问题列表前的标记。实际上,鉴于 R/exams 不知道问题出在哪里,我很惊讶这完全有效……

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

于 2018-10-04T00:20:15.560 回答