如何从命令行渲染 flexdashboard? [英] How to render flexdashboard from the command line?

查看:56
本文介绍了如何从命令行渲染 flexdashboard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 flexdashboard Rmd,当我在 RStudio 中按下 Knit 按钮时它会正确呈现.我想从命令行渲染它,但是当我使用命令 render("myfile.rmd", flex_dashboard())

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())

我的 Rmd 文件的标题如下:

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
---

推荐答案

你可以不带参数调用 render ,它会选择 YAML 中的所有选项:

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

render("myfile.Rmd")

奥尔顿是正确的,使用 flex_dashboard() 创建了一个使用所有默认值的新格式.要呈现格式并保留您使用的 YAML 设置:

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")

但仅当 flex_dashboard 不是 Rmd 中的默认格式时才需要后一种形式.

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

这篇关于如何从命令行渲染 flexdashboard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆