2012-08-09 120 views
3

我在尝试从github上下载所需的软件包之后滑动,如本文档中所述,在getting started with Slidify上。使用create_deck()创建卡组后,我在线上找到的测试代码中使用了函数slidingify()。这是代码:在Rstudio中使用Slidify和Knitr以及R Markdown时出错

--- 

### 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和其他所需的软件包的版本,但仍然不断遇到了此问题。感谢任何帮助。 最后,滑动创建一个.md文件或像一个正常的Rmarkdown与knitr一个HTML文件。我们如何将生成的.md文件转换为html文件。

+0

同一问题在这里 – jdennison 2012-08-30 17:06:30

+0

我曾经有过同样的问题。通过重新启动RStudio解决了它...我复制了您的代码,并在我的笔记本电脑上运行。 – Elaine 2012-10-28 23:05:15

回答

1

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

相关问题