Harini Devulapalli Harini Devulapalli - 1 month ago 10
R Question

Issue with YAML Header in R markdown File

I am trying to create a Flex Dashboard using R markdown. Once I start executing the code I see many error listed below:

YAML Header Error in .Rmd File

The Code after the YAML header is executed with no issues and because of the error above I am not able to get a flex dashboard as an output.

How to solve this error?

J_F J_F
Answer

Your error is, that you want to execute the YAML header in a R script. When you use RStudio, then go to 'File' -> 'New File' -> 'R Markdown' and enter the YAML header and your code. Then you can render your RMD file via CTRL+Shift+K or in the console via rmarkdown::render("<path-to-your-file>").

If you do not use RStudio, save the script as a Rmd file (*.Rmd) file and render it via console.

I think this will solve your problem.