gpt4 book ai didi

r - 在Rstudio中将Slidify与Knitr和R Markdown结合使用时出错

转载 作者:行者123 更新时间:2023-12-04 10:38:42 24 4
gpt4 key购买 nike

如本文档中getting started with Slidify所述,我从github下载了所需的软件包后尝试使用slidify。在使用create_deck()创建平台之后,我在网上找到的测试代码上使用了slidify()函数。这是代码:

--- 

### A Simple Plot

Let us create a simple scatterplot.

```{r simple-plot, fig.height = 6, fig.align = 'center', message = F}
require(ggplot2)
qplot(wt, mpg, data = mtcars)
```

---

### A Table

```{r table, results = 'asis', comment = NA}
library(xtable)
options(xtable.type = 'html')
xtable(head(mtcars))
```


我将上面的代码保存为test_slidify.Rmd,并使用slidify(“ test_slidify.Rmd”)对其进行了调用。但是,在下面的结尾处,我一直遇到以下错误:

processing file: C:/Users/VJ/test_slidify.Rmd
|>>>>>>>>>>>>> | 20%
ordinary text without R code

|>>>>>>>>>>>>>>>>>>>>>>>>>> | 40%
label: simple-plot (with options)
List of 4
$ fig.height: num 6
$ fig.align : chr "center"
$ message : logi FALSE
$ indent : chr " "

|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | 60%
ordinary text without R code

|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | 80%
label: table (with options)
List of 3
$ results: chr "asis"
$ comment: logi NA
$ indent : chr " "

|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
ordinary text without R code


output file: C:\Users\VJ\test_slidify.md

Error in mapply(function(i, j) doc[i:j], begin, end, SIMPLIFY = FALSE) :
Zero-length inputs cannot be mixed with those of non-zero length


我已经下载了slidify和其他所需软件包的最新版本,但仍然遇到此错误。感谢任何帮助。
最后,slidify是否仅创建.md文件或html文件(例如在带有knitr的常规Rmarkdown中)。我们如何将生成的.md文件转换为html文件。

最佳答案

通过在Slidify网站上的示例进行应对和粘贴,我遇到了相同的问题。这使文本编码混乱,从而导致故障。我最终手动输入了示例,然后它完美地构建了html文件。另请注意,您需要使用“ ---”语法(不带引号)来分隔幻灯片。不这样做会导致其他人的建筑崩溃。

关于r - 在Rstudio中将Slidify与Knitr和R Markdown结合使用时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11881144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com