Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create R documentation file (.Rd) in latex?

Tags:

r

latex

rstudio

Is there a simple way to create R documentation file for simple R functions?

I know I can edit a .Rd file in R-studio and preview it in HTML file. But how to put it into latex to edit and preview? Is there some latex package producing R documentation format?

like image 988
user1896629 Avatar asked Dec 12 '12 04:12

user1896629


2 Answers

There is the Rd2latex function in the tools package that will convert from the .Rd format to LaTeX format. This will let you preview the documentation in LaTeX. However this does not allow converting edits to the LaTeX document back to the .Rd document.

like image 92
Greg Snow Avatar answered Sep 28 '22 05:09

Greg Snow


Look at Sweave, maybe it helpful for you.

Sweave is a tool that allows to embed the R code for complete data analyses in latex documents.

The purpose is to create dynamic reports, which can be updated automatically if data or analysis change. Instead of inserting a prefabricated graph or table into the report, the master document contains the R code necessary to obtain it. When run through R, all data analysis output (tables, graphs, etc.) is created on the fly and inserted into a final latex document.

The report can be automatically updated if data or analysis change, which allows for truly reproducible research.

like image 36
ymn Avatar answered Sep 28 '22 05:09

ymn