outTeX: Export blocked or assigned data to .tex format files

View source: R/outTeX.R

outTeXR Documentation

Export blocked or assigned data to .tex format files

Description

Exports output from block or assignment to a set of .tex files using xtable.

Usage

outTeX(block.obj, namesCol = NULL, file.names = NULL, captions = NULL, digits = 2, ...)

Arguments

block.obj

a list of dataframes, such as output from block or assignment.

namesCol

an optional vector of column names to be used in output files.

file.names

an optional list of strings specifying the output file names.

captions

an optional list of strings specifying the table captions. See Details below.

digits

the number of digits to which to round multivariate distances in output files.

...

additional arguments passed to xtable.

Details

Under the default (file.names = NULL), each file is named “GroupXXX.tex”, where “XXX” is the group name taken from the input object. Under the default (captions = NULL), each caption is “Group XXX.”, where “XXX” is the group name taken from the input object.

outTeX appends .tex to the user-specified file.names.

The table reference labels are created as t:XXX, where XXX is the file name (without .tex) for the .tex file containing that table.

captions takes a list of strings of length equal to the number of groups in block.obj$blocks, if block.obj is output from block, or the number of groups in block.obj$assg, if block.obj is output from assignment.

The tables in the output .tex files can easily be integrated into an existing .tex document using LaTeX code \include{GroupXXX}.

Value

A set of .tex files, one for each element of the input list of blocked or assigned units.

Author(s)

Ryan T. Moore

See Also

outCSV, block, assignment

Examples

data(x100)

# First, block
out <- block(x100, groups = "g", n.tr = 2, id.vars = c("id"), block.vars
             = c("b1", "b2"), algorithm="optGreedy", distance =
             "mahalanobis", level.two = FALSE, valid.var = "b1",
             valid.range = c(0,500), verbose = TRUE)
# Second, assign
assg <- assignment(out, seed = 123)

# create three .tex files of blocks
## Not run: outTeX(out)

# create three .tex files of assigned blocks
#   (note: overwrites blocked .tex files)
## Not run: outTeX(assg)

# create three .tex files with custom file names and captions
## Not run: outTeX(assg, file.names = list("file1", "file2", "file3"), 
       captions = list("This is caption 1.", "Caption 2.", "Caption 3?"))
## End(Not run)

blockTools documentation built on Feb. 16, 2023, 7:14 p.m.