RStudio breaks YAML header when converting to PDF output

rstudio
rstudioserver

#1

I have an RMarkdown file open in RStudio Server v1.0.136. I typically compile to HTML format, so I have the YAML header set for this. However, if I try to compile to PDF instead, the Rstudio messes up the YAML and breaks the document.

The header goes from this:

---
title: "NGS580 Analysis Report"
author: '`r Sys.info()[["user"]] `'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
  html_document:
    toc: yes
    df_print: paged
    keep_md: yes
    css: styles.css
    number_sections: yes
params:
  child: !r c("flagstat.Rmd", "haplotypecaller.Rmd", "lofreq.Rmd", "sample-coverage.Rmd")
  input_dir: input
---

to this:

---
title: "NGS580 Analysis Report"
author: '`r Sys.info()[["user"]] `'
date: '`r format(Sys.time(), "%B %d, %Y")`'
output:
  pdf_document:
    toc: yes
  html_document:
    css: styles.css
    df_print: paged
    keep_md: yes
    number_sections: yes
    toc: yes
params:
  child: c("flagstat.Rmd", "haplotypecaller.Rmd", "lofreq.Rmd", "sample-coverage.Rmd")
  input_dir: input
---

Note that among other things, the R expression in the parameters has lost the leading !r which makes it work. It also re-arranges the order of the entries (inconseqential), and in one case it also broke the quoting of the R expressions I am using in my author and date field.

Here is a gif of it in action:


#2

This is a known issue in your older version of RStudio. The latest release, 1.1.447, shouldn't have this bug. Give it a try and let us know if you still see the problem!

https://www.rstudio.com/products/rstudio/download/