knitr: getting a parse_all error in R when convert

2019-01-14 15:50发布

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
```

3条回答
孤傲高冷的网名
2楼-- · 2019-01-14 16:33

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")
    
查看更多
Juvenile、少年°
3楼-- · 2019-01-14 16:38

I faced with the same exact problem, hence I came up with this page. Based on the suggestions, I installed R version 3.3.0, and uninstalled 3.2.4. I re-installed the packages. However, fread function stopped working. I read that it might be related to dll's being messed up etc. Then I completely uninstalled R, and Rstudio. I also deleted the library folder where the packages are installed. Re-installed R, then Rstudio (latest version 0.99.902), then the packages. Now everything is working fine.

查看更多
家丑人穷心不美
4楼-- · 2019-01-14 16:43

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.

查看更多
登录 后发表回答