Learn R Programming

blockTools (version 0.6.6)

outCSV: Export blocked or assigned data to .csv format files

Description

Exports output from block or assignment to a set of .csv files using write.csv.

Usage

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

Value

A set of .csv files, one for each element of the input list of blocked or assigned units, written by write.csv().

Arguments

block.obj

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

namesCol

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

file.names

An optional character vector of file names specifying the output file names.

digits

An integer representing the number of decimal places to which to round multivariate distances in output files, passed to round().

...

Additional arguments passed to write.csv.

Author

Ryan T. Moore

Details

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

See Also

outTeX, write.csv, block, assignment

Examples

Run this code
data(x100)

# Block and assign:
out <- block(x100, groups = "g", n.tr = 2, id.vars = "id", block.vars = c("b1", "b2"))
assg <- assignment(out, seed = 123)

# create three .csv files of blocks
if (FALSE) outCSV(out)
# create three .csv files of assigned blocks
#   (note: overwrites blocked .csv files)
if (FALSE) outCSV(assg)
# create three .csv files with custom file names
if (FALSE) outCSV(assg, file.names = c("file1", "file2", "file3"))

Run the code above in your browser using DataLab