2012-08-09 117 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文件。另請注意,您需要使用'---'語法(不帶引號)來分隔幻燈片。不這樣做會導致其他人的構建崩潰。

相關問題