I have the following R Markdown script called test.Rmd
:
---
params:
results:
value: !r mtcars
---
```{r setup, echo=FALSE, include=FALSE}
In R, run the following:
library(devtools)
install_github('viking/r-yaml')
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.