0

我实际上只是想为学习者降价运行默认脚本:

---
title: "Tutorial"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
```


## Topic 1

### Exercise 

*Here's a simple exercise with an empty code chunk provided for entering the answer.*

Write the R code required to add two plus two:

```{r two-plus-two, exercise=TRUE}

```

### Exercise with Code

*Here's an exercise with some prepopulated code as well as `exercise.lines = 5` to provide a bit more initial room to work.*

Now write a function that adds any two numbers and then call it:

```{r add-function, exercise=TRUE, exercise.lines = 5}
add <- function() {
  
}
```

## Topic 2

### Exercise with Hint

*Here's an exercise where the chunk is pre-evaulated via the `exercise.eval` option (so the user can see the default output we'd like them to customize). We also add a "hint" to the correct solution via the chunk immediate below labeled `print-limit-hint`.*

Modify the following code to limit the number of rows printed to 5:

```{r print-limit, exercise=TRUE, exercise.eval=TRUE}
mtcars
```

```{r print-limit-hint}
head(mtcars)
```

### Quiz

*You can include any number of single or multiple choice questions as a quiz. Use the `question` function to define a question and the `quiz` function for grouping multiple questions together.*

Some questions to verify that you understand the purposes of various base and recommended R packages:
quiz(
  question("Which package contains functions for installing other R packages?",
    answer("base"),
    answer("tools"),
    answer("utils", correct = TRUE),
    answer("codetools")
  ),
  question("Which of the R packages listed below are used to create plots?",
    answer("lattice", correct = TRUE),
    answer("tools"),
    answer("stats"),
    answer("grid", correct = TRUE)
  )
)

每次我运行它时,我都会收到此错误:

输出创建:闪亮预渲染应用程序(target_file,render_args = render_args)中的Quiz.html错误:没有服务器上下文或server.R可用于C:/Users/DELL/Dropbox/My PC(DESKTOP-SUOCLVS)/Desktop/Research Tools/R目录/Quiz.Rmd 调用:警告 -> shiny_pred_app:消息:在 strsplit 中,“\n” = TRUE):输入的字符串 1,用于此语言环境停止执行

有人知道我该如何解决这个问题吗?中文的最后一位只是说输入字符串不合适。

编辑:单击降价顶部的“运行测试”并得到以下信息:

==> Testing Shiny application using 'shinytest'

Error: tests/ directory doesn't exist
Backtrace:
    x
 1. \-shinytest::testApp("C:/Users/DELL/Dropbox/My PC (DESKTOP-SUOCLVS)/Desktop/Research Tools/R Directory/Quiz")
 2.   \-shinytest:::findTestsDir(path$dir, quiet = FALSE)
ִֹͣ��

Exited with status 1.

不确定这是否有帮助。如果像更改目录这样简单的事情,我不知道该怎么做。

4

0 回答 0