小编Ada*_*son的帖子

purit()在knit()内重复标签错误

我正在编织一个.Rmd文件,并希望有两个输出:每次运行编织时,html和一个purl'ed R脚本.这可以使用以下Rmd文件完成:

---
title: "Purl MWE"
output: html_document
---

```{r}
## This chunk automatically generates a text .R version of this script when     running within knitr.
input  = knitr::current_input()  # filename of input document
output = paste(tools::file_path_sans_ext(input), 'R', sep = '.')
knitr::purl(input,output,documentation=1,quiet=T)
```

```{r}
x=1
x
```
Run Code Online (Sandbox Code Playgroud)

如果你没有命名块,它工作正常,每次你运行knit()(或点击RStudio中的编织)时你得到html和.R输出.

但是,如果您将块命名为失败.例如:


title: "Purl MWE"
output: html_document
---

```{r}
## This chunk automatically generates a text .R version of this script when     running within knitr.
input  = knitr::current_input()  # filename of input document …
Run Code Online (Sandbox Code Playgroud)

markdown r rstudio knitr r-markdown

10
推荐指数
1
解决办法
2599
查看次数

标签 统计

knitr ×1

markdown ×1

r ×1

r-markdown ×1

rstudio ×1