r2lUniv.data.frame {r2lUniv}R Documentation

Method for data frame

Description

Method used by r2lUniv for data.frame.

On a data.frame, r2lUniv chooses the r2lUniv basic classes then runs the r2lUniv basic analysis on every column and finally exports the LaTeX code.

Usage

## S3 method for class 'data.frame':
r2lUniv(data, fileOutput = "", varName = "", varNumber = "", dirGraph = "", graphName = "V", limDiscrete = 10, classModification = "",...)

Arguments

data data.frame; to print
fileOutput character; name of the output file to save the LaTeX code. If empty, code is printed on screen.
varName character, single or vector; gives a name to each LaTeX summary. The following values are possible :
  • varName="": The names of the data.frame columns are used.
  • varName=NA: No title.
  • varName="Title": Title will be used for all the variables. It might be useful in conjonction with varNumber=""
  • varName=c("Name1","Name2","..."): User-defined title. The vector is NOT recycled, it must have one title for each column.
varNumber numeric, single or vector; gives a number to each LaTeX summury. The following values are possible :
  • varNumber="" The number of the data.frame columns is used.
  • varNumber=NA No number.
  • varNumber=c(4,2,...) User-defined numbers. The vector is NOT recycled, it must have one number for each column.
dirGraph character; Directory used to save the graph generated by the analyses.
graphName character, single or vector; Prefix of the graphs' names. It can be a single name or a vector. In case of single name, it will be paste with varNumber if varNumber is "" or a user-defined vector; it will be paste with 1:length(dataFrame) if varNumber is NA. Warnings: if varNumber is user-defined and some numbers are use more than once, different graphs will have the same name, some will be erased.
limDiscrete numeric; Fixes the limit that distinguishes continuous variables from discrete ones. See r2lFindClass for details.
classModification Either a list list(nominal=c(...), ordinal=c(...), discrete=c(...), continuous=c(...)), or ""; Allowes the user to change manually some basic type. The list must have exactly four fields (potentially empty) in the specified order. See r2lModifyClasses for details.
... For S3 compatibility only

Details

On a data.frame, r2lUniv sets the r2lUniv basic classes then runs the analyses on every column.

The r2lUniv basic classes are first set by the r2lFindClasses function; optionally, if classModification is not "", some classes are changed by r2lModifyClasses.

Then r2lUniv is called on every column one by one. See r2lUniv.r2lBasicClasses.

Value

r2lUniv either prints LaTeX code on the screen or saves it in a file. It also generates several encapsuled postsript graphs (.eps), optionally in a directory.

Classical usage

The use of r2lUniv goes through the following steps:
Step 1. Load the data.frame.
Step 2. Optionally, set some variables as ordered.
Step 3. Optionally, change the type of some variables (to force some discrete to be continuous, some logical to be ordered, ... ; see r2lModifyClasses for details.
Step 4. Run r2lUniv(dataFrame,"fileOut.tex") or r2lUniv(dataFrame,"fileOut.tex",classModification=listModif) if the type of some variables must change.

See examples of r2lUniv for an application [].

R to LaTeX, Bivariate Analyses

r2lBiv (R to LaTeX, Bivariate Analyses) is under contruction. Any help will be welcomed!

Author

Christophe Genolini
christophe.genolini@free.fr
PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health
INSERM U669 / Maison de Solenn / Paris

English correction

Jean-Marc Chamot
jchamot@u-paris10.fr
Laboratoire "Sport & Culture" / "Sports & Culture" Laboratory
University of Paris 10 / Nanterre

References

LaTeX web site http://www.latex-project.org/

See Also

Sweave, latex, r2lUniv, r2lConcepts, r2lUniv.r2lBasicClasses, r2lUniv.Rclasses, r2lFindClasses

Examples

 # # # # # # # # # # # # # # # # # # #
#   R to LaTeX, Univariate Analyses   #
 #             Examples              # 
  #           data.frame            #
   # # # # # # # # # # # # # # # # #


########################
###### Step 1: Load the data

data(examCheating)
str(examCheating)

########################
###### Step 2: Set ordered

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: Change some classes.
### Everything seems ok

########################
###### Step 4: Run

### The following code will create some files.
### So we advise you to first move to directory "r2lUnivExample"
dir.create("r2lUnivExample")
setwd("r2lUnivExample")

r2lUniv(examCheating[,-1],"cheatAnalyses.tex")

### Creates the main document.
r2lGenerateLatexMain("cheatAnalyses.tex")

### Everything is ready, you can now run LaTeX on the file "main.tex"
setwd("..")

[Package r2lUniv version 0.9 Index]