4

Not a duplicate: this question is about RStudio, not the R command prompt

I have an RMD file with two output formats in the header. However when I press "Knit" in RStudio, only the first output happens. Is this fixable?

Header:

---
title: "title"
output:
  html_document:
    css: style.css
    code_folding: hide
    dev: CairoSVG
    toc: yes
  github_document:
    df_print: kable
    toc: yes
---

Edit: It turns out the the "preview" version of RStudio allows you to pick which output you want. But outputting one will delete the other output.

sharoz
  • 6,157
  • 7
  • 31
  • 57
  • It is behaving as documented. I think by "fixable" you mean "customizable", and the way to do that is probably by calling `rmarkdown::render` in a script and specifying the `output_format` argument. – Gregor Thomas Sep 20 '16 at 17:40
  • One possible value for `output_format` is `"all"`. I'm wondering if it's possible to set that value in RStudio https://github.com/rstudio/rmarkdown/blob/2b25d39f1924f2b751cbf013cf8176baa96461b8/R/render.R#L30 – sharoz Sep 20 '16 at 18:42
  • Possible duplicate of [Knit one markdown file to two output files](https://stackoverflow.com/questions/39662365/knit-one-markdown-file-to-two-output-files) – Robert Longson Aug 05 '17 at 18:05
  • @RobertLongson That solution is not for RStudio. It's just for the R command line. – sharoz Aug 05 '17 at 21:59

1 Answers1

1

I didn't want to flag this post as a duplicate as you posted the question first. However, the answer was posted a few days later at the below link. I placed it here so others can find it if they land on your question.

Knit one markdown file to two output files

Hong Ooi
  • 56,353
  • 13
  • 134
  • 187
Justin
  • 1,360
  • 12
  • 15