1

我正在编写一个学习者课程,我想为学生提供错误代码供他们修复或演示错误。例如:

---
title: "coding - intro"
output:
  learnr::tutorial:
    progressive: true
    allow_skip: true
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(learnr)
```


```{r code_intro_data_type_error, exercise = FALSE, exercise.eval = FALSE}
weeks <- 4
days_in_week <- "7"

# we now attempt to multiple a number by a string
total_days <- weeks * days_in_week
```

理想情况下,我还想输出错误消息:

周错误 * days_in_week :二进制运算符的非数字参数

但是由于代码在该块中有错误,它拒绝编译学习器脚本

4

0 回答 0