rtlu {r2lUniv} | R Documentation |
rtlu
performs some basic analyses, then generates a
code to be included in a LaTeX document to print the analyses in a (so
nice!) LaTeX way.
rtlu(data,fileOutput="",textBefore="",textAfter="",graphDir="graphUniv",graphName="V",...)
data |
[data.frame] or a [vector] : containt the
data to analyse. |
fileOutput |
[character] ;
name of the output file in which
the LaTeX summary will be saved. If empty, the LaTeX code is printed on screen. |
textBefore |
[character] or [vector(character)] : before
printing a variable analysis, rtlu can write a
text. If rtlu is apply on a single variable,
textBefore should be of lenght 1. If rtlu is apply on a data.frame,
textBefore can have the lenght of the data.frame (this let
the user to write a specific introduction for each variable), or can be
of length 1. In this case, it is print before each variable
analysis. See examples for detail. |
textAfter |
[character] or [vector(character)] : after
printing a variable analysis, rtlu can write a
text. If rtlu is apply on a single variable,
textAfter should be of lenght 1. If rtlu is apply on a data.frame ,
textAfter can have the lenght of the data.frame (this let
the user to write a specific conclusion for each variable), or can be
of length 1. In this case, it is print after each variable
analysis. See examples for detail. |
graphDir |
[character] ;
directory used to save the graph generated by the analyses. |
graphName |
[character] or [vector(character)] :
prefix of the graphs' names. If empty, the graphs' name are
\code{V1} to \code{V length(data.frame)} |
... |
rtlu distinghues two kind of numeric :
discrete are numeric variable with only few
modalities, continuous are numeric variable with many
modalities. The limit between 'few' and 'many' can be fixed by the
user through the argument limDiscrete . By setting
limDiscrete to 5, the user will ask rtlu to consider
all the numeric variable with more than 5 modalities as
continuous and all the variable with less than 5 modalities
as discrete .
The default value for limDiscrete is 10.
... can also be use to precise some graphical parameters. |
rtlu
performs some basic analyses, then generates a
code to be included in a LaTeX document to print the analyses in a (so
nice!) LaTeX way.
rtlu
performs the analyses automatically according to the
data
class. It considers 4 classes. The analysis of the
variable depend of the class:
On a data.frame
, rtlu
runs the analyses on every column.
rtlu
generates a LaTeX code and either prints it on screen or saves it in a
file. It also generates several encapsulated postscript graphs, optionally
in a different directory.
The use of rtlu
goes through the following steps:
Step 1. | Load the data (usually, a data.frame ). |
Step 2. | Optionally, set some variables as ordered . |
Step 3. | Run rtlu(dataFrame,"fileOut.tex") . |
See examples an application.
r2lBiv (R to LaTeX, Bivariate Analyses) is under construction. Any help will be welcomed!
Christophe Genolini
christophe.genolini@free.fr
PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health
INSERM U669 / Maison de Solenn / Paris
Jean-Marc Chamot
jchamot@u-paris10.fr
Laboratoire "Sport & Culture" / "Sports & Culture" Laboratory
University of Paris 10 / Nanterre
LaTeX web site http://www.latex-project.org/
Data are available on line: http://christophe.genolini.free.fr/EPO/EPO2007-Fraude.php
r2lUniv-package
,
rtluMainFile
,
examCheating
,
Sweave
,
latex
# # # # # # # # # # # # # # # # # # # # R to LaTeX, Univariate Analyses # # Examples # # rtlu single variable # # # # # # # # # # # # # # # # # # ######################## ###### Step 1: Create the data V1 <- factor(LETTERS[floor(runif(50,1,4))]) V2 <- rnorm(50,1,1)<0 V3 <- ordered(LETTERS[floor(runif(50,1,4))]) ######################## ###### Step 2: ordering variable # nothing to do ######################## ###### Step 3: running r2lu ### The following code will create some files. ### So we first move in a directories. dir.create("exampleSingle") setwd("exampleSingle") rtlu(V1,fileOutput="First.tex",textBefore="\\section{Variable 1 to 3}",graphName="V1") rtlu(V2,fileOut="Second.tex",graphName="V2") rtlu(V3,fileOut="Third.tex",textBefore="\\newpage \n This is variable 3",graphDir="P") rtluMainFile(c("First.tex","Second.tex","Third.tex")) setwd("..") # # # # # # # # # # # # # # # # # # # # R to LaTeX, Univariate Analyses # # Real examples # # rtlu data.frame # # # # # # # # # # # # # # # # # # ######################## ###### Step 1: Create the data data(examCheating) str(examCheating) ######################## ###### Step 2: ordering variable examCheating$YearOfStudy <- ordered(examCheating$YearOfStudy,levels=c("L1","L2","L3","M1","M2")) examCheating$Bac <- ordered(examCheating$Bac,levels=c("Remedial exam","Pass","Fairly good","Good","Very good","Summa cum laude")) for(iColumn in 8:17){ examCheating[,iColumn] <- ordered(examCheating[,iColumn],levels=c("Never","Rarely","Sometimes","Often","Always")) } str(examCheating) ######################## ###### Step 3: running r2lu ### The following code will create some files. ### So we first move in a directories. dir.create("exampleReal") setwd("exampleReal") ### Then we prepare the textBefore, for transition between variable textBefore <- c( "\\tableofcontents\n\\section{Global information} \\subsection{What is your age?}", " \\subsection{What is your gender?}", " \\subsection{What is your level?}", " \\subsection{What is your field?}", "\\section{Cheating variables} \\subsection{Did you cheat at Bac?}", " \\subsection{Did you cheat high scool?}", " \\subsection{Cheating score}" ) textAfter="For a detailled analysis, see http://christophe.genolini.free.fr/EPO/2007 Fraude/EPO2007-Fraude-Rapport.pdf" ### We can run r2lu rtlu(examCheating[,c(2:5,18:20)],fileOutput="ExamCheat-univ.tex",textBefore=textBefore) rtluMainFile(c("ExamCheat-univ.tex")) setwd("..") ### Then compile main.tex twice. It is ready !