Can't generate plotly interactive plots in Rmarkdown report

后端 未结 1 973
Happy的楠姐
Happy的楠姐 2021-01-15 02:40

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

相关标签:
1条回答
  • 2021-01-15 03:12

    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.

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