我用 R 包“学习者”做了多项选择题。如何让 R 计算用户正确回答问题的数量?以下是部分代码:
question("Question 1. What is the mean of the data: 2, 5, 8, 8, 2, 5?",
answer("3.5", message = "Try again."),
answer("4", message = "Try again."),
answer("4.5", message = "Try again."),
answer("5", correct = TRUE, message = "Good job!"),
answer("5.5", message = "Try again."),
type = "single",
allow_retry = TRUE
)
question("Question 2. What is the mean of the data: 20, 50, 80, 80, 20, 50?",
answer("35", message = "Try again."),
answer("40", message = "Try again."),
answer("45", message = "Try again."),
answer("50", correct = TRUE, message = "Good job!"),
answer("55", message = "Try again."),
type = "single",
allow_retry = TRUE
)