3
votes

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?

1
How about asking directly to RStudio: support.rstudio.com/hc/en-ususer3710546
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
The “pdf” option is LaTeX. Simply ensure in the options that the intermediate .tex file isn’t deleted.Konrad Rudolph
@Pascal I received response from R Studio: support.rstudio.com/hc/en-us/community/posts/…matandked

1 Answers

2
votes

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