[R] R to LaTeX Univariate Analysis

Christophe Genolini cgenolin at u-paris10.fr
Mon Dec 31 16:24:04 CET 2007

Hi all

Well, first: happy new year...

Second: I write a function in R that might interest some other people. 
On the other hand, I am closer to beginners than experts; I don't know 
how valuable my code is. I don't know how long it will take to me to 
create a library and I don't know if it's worth to. So before starting 
this long process, I would like some advices, both on the interest it 
present, on the way of using it and on the inner R code...

My function is called "r2lUniv" for "R to LaTeX, Univariate analysis". 
Given a variable, it performs some basic analysis in R and generates 
LaTeX code to include in a document that print the analysis in a clean 
LaTeX way. The basic analysis depends of the variable type. 4 types are 
  - Nominal: modality, size, barplot
  - Ordinal: modality, size, quartile, barplot
  - Discrete: modality, size, mean, var, quartile, boxplot, barplot
  - Continuous: mean, var, quartile, boxplot, barplot

A generalization of r2lUniv deals with data.frame by runnig the basic 
analysis on every column. So to use it:
 > dataFrame <- read.csv("myData.csv")
 > r2lUniv(dataFrame,"fileOut.tex")

It performs the basic analysis and creates all graphs. Then I add 
\input{fileOut.tex} in my main.tex file.

My source file is available at: 
It is definitely NOT a code ready for a library, there is probably bugs 
in it, all comments and all variables used for testing are in. But 
still, any advices will be welcome...


PS: Does the  manual "Writing R Extensions" exists in French? Or 
anything equivalent?

More information about the R-help mailing list