- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道是否可以在 Rnw 文件练习中发表评论,以便 R 和 LaTeX 可以完全忽略某些内容。这对我进行一些灵活性 build 练习很有用。
特别是,我想做一个有五个选项的多项选择题,其中给出两个正确的陈述和两个错误的陈述,并在一个正确的陈述和两个错误的陈述之间随机选择另一个陈述。试图实现这一点,如 http://www.r-exams.org/templates/boxplots/结果证明对我来说非常困难,因为所有这些语句都涉及 LaTeX 编码,所以我在将它插入 R chunck 时遇到了问题。所以我尝试了一些不同的方法,但是我收到一条错误消息,说 exsolution 和 questionlist 的长度不匹配。也许,有一些方法可以使评论起作用。
<<echo=FALSE, results=hide>>=
scelta=sample(c("%'","%'",""),size=3, replace=FALSE)
if (scelta[1]=="%'") soluz=c(1,1,rep(0,3)) else soluz=c(1,1,1,0,0)
@
\begin{question}
Say which statements are true.
\begin{answerlist}
\item first true statement
\item second true statement
\Sexpr{scelta[1]} \item third true statement
\item first wrong statment
\item second wrong statment
\Sexpr{scelta[2]} \item statment
\Sexpr{scelta[3]} \item statement
\end{answerlist}
\end{question}
\begin{solution}
<<echo=FALSE, results=tex>>=
answerlist(ifelse(soluz, "Vero", "Falso"))
@
\end{solution}
\exname{name_exercise}
\extype{mchoice}
\exsolution{\Sexpr{mchoice2string(soluz)}}
\exshuffle{5}
最佳答案
我不建议通过插入注释来执行此操作,因为 (a) 代码(至少在我看来)不太清楚,并且 (b) 您仅限于某些采样模式。相反,我宁愿在 R 代码中做这样的事情:
ans <- c(
"This is the first statement and correct.",
"This is the second statement and also correct.",
"This is the third and last correct statement.",
"This is the fourth statement and it is false.",
"This is the fifth statement, the second false one.",
"This is the sixth statement, false again.",
"This is the seventh statement, it is false and the last one."
)
sol <- rep(c(TRUE, FALSE), c(3, 4))
i <- sample(1:7, 5)
ans <- ans[i]
sol <- sol[i]
answerlist(ans)
等以在问题中包含答案列表。
i
被计算。例如,你可以这样做:
i <- c(sample(1:3, 2), sample(4:7, 2)) ## two true, two false
i <- sample(setdiff(1:7, i), 1) ## one additional
i <- sample(i) ## permute
exshuffle
标签。
关于r - 如何使用 R 考试在 Rnw 文件中进行评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61319788/
我正在准备 SQL Server 考试 (70-431)。我有 Sybex 的书 "SQL Server 2005 - Implementation and Maintenance" .我对估计一张
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: What is the proper declaration of main? 我刚刚参加了第一次 C++
我刚刚参加了考试,被问到以下问题: Write the function body of each of the methods GenStrLen, InsertChar and StrRevers
如何通过 {exams} 包创建一个 moodle 问题,该问题至少为多项选择题打分? 我已经试过了: exams2moodle(..., mchoice = list(eval = list(neg
我正在为我们的项目进行 PAX 集成测试,我在类加载方面遇到了一些问题。 我在 PAX(使用的 karaf 容器)中部署了几个包。 karaf 启动后,我可以看到我的包和服务已启动并处于事件状态。但是
我正在尝试使用 PAX Exam 设置测试,如下所示: @ExamReactorStrategy(PerMethod.class) public class AbstractTest { @C
我正在参加过去的 Java 考试,但有一个问题一直困扰着我。 问题是:“任何构造函数显式或自动调用其父类的构造函数,父类调用其父类,依此类推类层次结构。这个过程的名称是什么? 感谢您的回答! 最佳答案
我正在准备 Java 程序员认证 (SCJP) 考试。关于异常的问题,当处理异常时,最好是处理特定的异常,如 NumberFormatException ,还是使用父级 Exception 类捕获所有
我一直在准备 SCJP,现在是 Oracle 认证专业 Java SE 程序员考试。 我很难理解所有不同的集合以及何时使用它们。我也喜欢闪存卡。因此,我尝试创建一组本质上相同的类,除了它们使用的集合之
在 MS Exam 70-536 .Net Foundation ,案例场景 1 中的第 3 章“搜索、修改和编码文本” Your organization, Northwind Traders, i
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
在MS Exam 70-536 .Net Foundation ,第1课Creating Threads中的Chapter 7“Threading”有一段文字: Be aware that becau
我正在与 exams2nops 合作R/exams 包的功能。由于我所在大学的学生注册号只有六个数字,我尝试调整了reglength exams2nops 中的选项(通常最少 7 个)功能以及nops
我的目标是使用 R/exams 和 Moodle 创建一个问题,包括在 Rmd 练习文件中生成的一些图。学生应口头描述情节,然后手动评分练习。 是否可以使用 exams2moodle为 Moodle
大家好,最近一次 MCQ 复习了我做错的答案。 函数 getSum 被定义为计算大小为 a[] 的 double 组中值的总和大小,大于给定的输入值阈值。下面显示了四个原型(prototype)定义,
我从官方 MCTS 考试 70-562 书中得到的小测试程序没有触发事件。我在 Debug模式下跟踪了计算机逻辑,它甚至没有进入我的事件,即使我已经设置好一切来处理它们。所以最大的问题是我做错了什么?
我已经开始使用 PAX-EXAM 和 Karaf 容器来测试我们的应用程序。有时,测试只是在测试方法开始之前挂起,并且始终卡在 cxf 注册 mbean 上: 正在注册 MBean org.apach
在第一版C# 70-483 Exam Ref , 示例 1-12 给出了将子任务附加到父任务的示例。我认为这是错误的,并希望有人在继续这个假设之前检查我的理解。示例中的代码如下: using Syst
我目前正在准备 Microsoft 考试 70-480。在实践测试中,我发现了以下问题,我无法解释其答案。 谁能解释为什么这是正确答案? You are developing a web page b
我正在阅读 MCTS 自定进度培训工具包(考试 70-536):Microsoft .NET Framework — 应用程序开发基础,第二版电子书。 现在我正在完成线程章节(第 7 期)。在第 2
我是一名优秀的程序员,十分优秀!