Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

knitr: getting a parse_all error in R when converting Rmd file into HTML

I am getting below Parsing error each time I use Knit Html in R for converting my Rmd files into HTML:

Error in parse_all(input, filename, stop_on_error != 2L) : unused argument (stop_on_error != 2) Calls: ... call_block -> block_exec -> in_dir -> evaluate -> parse_all

Execution halted

Same result is obtained when using knitr or knitr:knit2html from the command line. Error did not exist before (I have already used Knit HTML for many .Rmd reports) but appeared when I used knit2html from the cmd for the first time. The compilation is only working where there are no R code chunks in the .Rmd file or when the chunks are empty. I work under windows 7, R version: 3.2.3, R studio version: 0.99.902. Below is the only R code chunk in the test.Rmd file that I am using for testing:

```{r}
i <- 0
i < i + 3
i
```
like image 429
Ghida Ibrahim Avatar asked May 15 '16 17:05

Ghida Ibrahim


People also ask

How do I convert RMD to HTML in R?

To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.

How do I convert a RMD file to R?

If you use the RStudio IDE, the keyboard shortcut to render R scripts is the same as when you knit Rmd documents ( Ctrl / Cmd + Shift + K ). When rendering an R script to a report, the function knitr::spin() is called to convert the R script to an Rmd file first.

Why is my R Markdown file not knitting?

No Knit HTML button This means that RStudio doesn't understand your document is supposed to be an RMarkdown document, often because your file extension is . txt . To fix this, go to the Files tab (lower right corner, same pane as Plots and Help) and select the checkbox next to your document's name.


2 Answers

After seeing the same error, the following (updating evaluate package) helped me

install.packages("evaluate")

Evaluate is used by knitr. Here is a link to CRAN about evaluate: https://cran.rstudio.com/web/packages/evaluate/index.html

My R version is 3.2.4. There is no need to do any complicated re-installs. Try this first.

like image 194
userJT Avatar answered Oct 17 '22 21:10

userJT


Yes, Vincent is right. You seem to have updated your knitr package to version 1.13 in the last days. This version only runs under the new R version 3.3.0 (also released a couple days ago).

You have two options:

  1. Update R to version 3.3.0
  2. Revert your knitr installation to version 1.12 using the following code:

    packageurl <- "http://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.12.tar.gz"
    install.packages(packageurl, repos=NULL, type="source")
    
like image 16
tah385 Avatar answered Oct 17 '22 22:10

tah385