3

I found R markdown/knitr useful tool to document my work and generate summary document.

I work with .Rmd (R markdown) files in RStudio. It seems that knitr provide appropriate functionality to generate .odt (Open Document Text) and .tex (LaTeX) documents from .Rmd.

However, R studio allows to choose .docx, .html and .pdf formats only.

R Markdown output formats in RStudio

New R Markdown wizard in RStudio

I would like to avoid MS Word format since I prefer open standards and working under Linux.

Is it possible to add .odt and .tex options to Rstudio menu?

matandked
  • 1,527
  • 4
  • 26
  • 51
  • 1
    How about asking directly to RStudio: https://support.rstudio.com/hc/en-us –  Dec 08 '15 at 08:35
  • Would there be anything wrong with using HTML, which is in theory an OS-independent format? Or could you consider converting between PDF and LaTEX format? – Tim Biegeleisen Dec 08 '15 at 08:36
  • The “pdf” option *is* LaTeX. Simply ensure in the options that the intermediate .tex file isn’t deleted. – Konrad Rudolph Dec 08 '15 at 10:38
  • 1
    @Pascal I received response from R Studio: https://support.rstudio.com/hc/en-us/community/posts/207639177-Add-odt-and-tex-as-output-options-from-R-Markdown – matandked Dec 18 '15 at 19:31

1 Answers1

2

It doesn't seem possible to output odt directly in RStudio, but you can always use knitr::knit to produce a markdown document and pandoc to produce the odt:

library(knitr)
knit("myDoc.Rmd")
system("pandoc myDoc.md -o myDoc.odt")

You may have to adjust the pandoc options and adapt the template to get a nice looking result.

As for latex, you can keep the tex sources when compiling to pdf with the following option in your yaml front matter:

---
output:
  pdf_document:
    keep_tex: true
---
scoa
  • 19,359
  • 5
  • 65
  • 80