I can't compile any .Rmd document with shiny. For example, this five-line document (or any document, e.g. the one created with File->New File -> R Markdown ... : Shiny Document)
---
title: "Untitled"
output: flexdashboard::flex_dashboard
runtime: shiny
---
End of my very short document.
I get this error when I click on "Run Document" button:
==> rmarkdown::run('/home/gxd/R-codes/lesson10/tmp.Rmd', shiny_args = list(launch.browser = FALSE), auto_reload = FALSE, dir = '/home/gxd/R-codes/lesson10', render_args = list(encoding = 'UTF-8'));
Error in yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: while scanning a quoted scalar at line 2, column 8 found unexpected end of stream at line 8, column 15
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>
Execution halted
Following this advise: RMarkdown error in YAML I checked for all spaces and other special symbols in YAML header. All seems correct.
Anyone knows what causes it and how to fix it? My session info below:
> sessionInfo()
R version 3.6.1 (2019-07-05)
...
> packageVersion("shiny")
[1] ‘1.5.0’
> packageVersion("rmarkdown")
[1] ‘2.3’
> packageVersion("knitr")
[1] ‘1.28’
I've found that if I create New Project, and then I create a new R Markdown file with Shiny, then it compiled just fine.
I must be something that was in my previous project directory that was preventing from compiling my .Rmd with file with shiny. I do have plenty of other files there (including other .Rmd with shiny, none of which compiled) and various sub-directories (where I also have .Rmd files with shiny, and where they DO compile).
But I still have not figured what exactly was causing the problem. I tried to delete ./Rproj.user and .Rhistory - it did not have any effect.
So I've created a new clean directory and put my simple 5 line .Rmd file shown above and it compiled.
I'm still very curious to understand what was the problem...
UPDATE:
Now I know where the problem was! -
In the same directory I had another unrelated "unfinished" .Rmd file.
This other .Rmd file had YAML header with unfinished (open) string in title:
title: "The Header of another Rmd file that was in the same directory
Note, title is missing closing ".
Once I fixed it, i can now compile any other .Rmd in the same directory.
But if i leave it unfixed, I wil lnot be to compile ANY other .Rmd in the same directory!
That;s kinda strange, but that's how it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With