Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render flexdashboard from the command line?

I have a flexdashboard Rmd that renders correctly when i press the Knit button in RStudio. I would like to render it from the command line but the naviagation bar does change when I use the command render("myfile.rmd", flex_dashboard())

The heading of my Rmd file is the following:

---
title: "Flexdashboard"
output: 
  flexdashboard::flex_dashboard:
      theme: cosmo
      navbar:
      - { title: "Draft-For Internal Use Only", align: right }
      source_code: embed
---
like image 251
rjss Avatar asked Aug 08 '16 13:08

rjss


People also ask

How do I publish a Flexdashboard?

To publish a flexdashboard, click the blue button on the top right of the HTML file & publish your code to RPubs.

How do I add a sidebar to my Flexdashboard?

You add an input sidebar to a flexdashboard by adding the {. sidebar} attribute to a column, which indicates that it should be laid out flush to the left with a default width of 250 pixels and a special background color.


2 Answers

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.

like image 195
JJ Allaire Avatar answered Oct 10 '22 10:10

JJ Allaire


pass arguments within the flex_dashboard().

For example:

render("myfile.rmd", flex_dashboard(theme=simplex),output='myfile_html')
like image 27
Altons Avatar answered Oct 10 '22 09:10

Altons