I have an Rmarkdown document with a plot made with plotly and would like to generate an html file. It works when I click on Knit to HTML in Rstudio, but not when I
Try:
Rscript -e "library(knitr); library(rmarkdown); rmarkdown::render('untitled.Rmd', output_file='report.html')"
Reasoning: knit seems to default to markdown output, and markdown cannot contain HTML. Thus, when converting, you end up with missing files (you can see these errors if you remove echo=FALSE
from the code block openings.
rmarkdown::render([...])
renders cleanly to HTML, avoiding the issues mentioned above. If you wish to specify the output format, you can do so using the output_format
argument.