readCsvBatch {wrMisc} | R Documentation |
Read batch of csv-files
Description
This function was designed to read screening data split in parts (with common structure) and saved to multiple files,
to extract the numeric columns and to compile all (numeric) data to a single array (or list). Some screening platforms save results while progressing
through a pile of microtiter-plates separately. The organization of the resultant files is structured through file-names and all files have exactely the same organization of lines and columns/
European or US-formatted csv files can be read, if argument fileFormat
is NULL
both types will be tested, otherwise it allows to specify a given format.
The presence of headers (to be used as column-names) may be tested using checkFormat
.
Usage
readCsvBatch(
fileNames = NULL,
path = ".",
fileFormat = "Eur",
checkFormat = TRUE,
returnArray = TRUE,
columns = c("Plate", "Well", "StainA"),
excludeFiles = "All infected plates",
simpleNames = TRUE,
minNamesLe = 4,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
Arguments
fileNames |
(character) names of files to be read, if |
path |
(character) where files should be read (folders should be written in R-style) |
fileFormat |
(character) may be |
checkFormat |
(logical) if |
returnArray |
(logical) allows switching from array to list-output |
columns |
(NULL or character) column-headers to be extracted (if specified), 2nd value may be comlumn with rownames (if rownames are encountered as increasing rownames) |
excludeFiles |
(character) names of files to exclude (only used when reading all files of given directory) |
simpleNames |
(logical) allows truncating names (from beginning) to get to variable part (using .trimLeft()), but keeping 'minNamesLe' |
minNamesLe |
(interger) min length of column-names if simpleNames=TRUE |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allows easier tracking of messages produced |
Value
This function returns an array (or list if returnArray=FALSE
) of all numeric data read (numerical columns only) from individual files
See Also
read.table
, writeCsv
, readXlsxBatch
Examples
path1 <- system.file("extdata", package="wrMisc")
fiNa <- c("pl01_1.csv","pl01_2.csv","pl02_1.csv","pl02_2.csv")
datAll <- readCsvBatch(fiNa, path1)
str(datAll)
## batch reading of all csv files in specified path :
datAll2 <- readCsvBatch(fileNames=NULL, path=path1, silent=TRUE)