How to render flexdashboard from the command line?

那年仲夏 提交于 2019-12-01 08:48:27

You can call render with no arguments and it will pick up all of the options in YAML:

render("myfile.Rmd")

Altons was correct that using flex_dashboard() creates a new format that uses all the defaults. To render a format and keep the settings from YAML you use:

render("myfile.Rmd", "flex_dashboard")

But this latter form is only required if flex_dashboard isn't already the default format within the Rmd.

pass arguments within the flex_dashboard().

For example:

render("myfile.rmd", flex_dashboard(theme=simplex),output='myfile_html')

FWIW, and to prevent people from saying, wait, what's render? Why can't I use knit?.... o ok, so why can't I then use knit2html? These are the steps to render a flexdashboard from the command line:

  1. Install Pandoc

  2. Close your current cmd if you haven't already.

  3. Run this command: "C:\Program Files\R\R-3.2.2\bin\x64\R.exe" -e "rmarkdown::render('C:/FULLPATH/myFlexDashboard.Rmd')"

  4. If it works, put that in a .bat file and celebrate!

(for step 3, note the slashes/backslashes... they should be exactly like that, but your R version might be different)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!