Error in YAML with R Markdown

后端 未结 2 1506
春和景丽
春和景丽 2020-12-21 04:23

I have the following R Markdown script called test.Rmd:

---
params: 
  results: 
  value: !r mtcars
---

```{r setup, echo=FALSE, include=FALSE}         


        
相关标签:
2条回答
  • 2020-12-21 05:04
    1. Install the devtools package from CRAN.
    2. In R, run the following:

      library(devtools)

      install_github('viking/r-yaml')

    0 讨论(0)
  • 2020-12-21 05:06

    I took a while to fix this as well. It seems the new knitr needs a version of yaml 2.2.0 and above.

    This help from @ScientificProgrammer on github here https://github.com/viking/r-yaml/issues/56#issuecomment-441394840 helped me. The solution was to install the new package using devtools from within standard R not RStudio. I did get some compiler error messages but it seemed to work. So don't let that put you off.

    So inside Standard R assuming you have the devtools package

    library(devtools)
    devtools::install_github("viking/r-yaml")
    

    I am copying their answer over in full below to help people in case the link breaks:

    In case it helps, I was having the same problem as IndrajeetPatil when I tried to run devtools::install_github("viking/r-yaml") from within RStudio. If I ran install.packages("viking/r-yaml") from within RStudio, the problem was resolved.

    However, when I exited RStudio and ran devtools::install_github("viking/r-yaml") from within the standard R client, I still received the same compiler warnings, but the problem also went away.

    P.S. Another popular solution that helped some people was to delete the yaml directory completely e.g. using Windows Explorer. Restart RStudio Ctrl + Shift + F10, and then re-install yaml package. That did not work for me as it kept giving me just 2.1.18 version.

    0 讨论(0)
提交回复
热议问题