readXlsxBatch {wrMisc} | R Documentation |
Read Batch of Excel xlsx-Files
Description
readXlsxBatch
reads data out of multiple xlsx files, the sheet indicated by 'sheetInd' will be considered.
All files must have the same organization of data, as this is typically the case when high-throughput measurements are automatically saved while experiments progress.
In particular, the first file read is used to structure the output.
Usage
readXlsxBatch(
fileNames = NULL,
path = ".",
fileExtension = "xlsx",
excludeFiles = NULL,
sheetInd = 1,
checkFormat = TRUE,
returnArray = TRUE,
columns = c("Plate", "Well", "StainA"),
simpleNames = 3,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
Arguments
fileNames |
(character) provide either explicit list of file-names to be read or leave |
path |
(character) there may be a different path for each file |
fileExtension |
(character) extension of files (default=' |
excludeFiles |
(character) names of files to exclude (only used when reading all files of given directory) |
sheetInd |
(character or integer) specify which sheet to extract (as exact name of sheed or sheet-number, eg |
checkFormat |
(logical) if |
returnArray |
(logical) allows switching from array to list-output |
columns |
(NULL or character) column-headers to be extracted (if specified, otherwise all columns will be extracted) |
simpleNames |
(integer), if |
silent |
(logical) suppress messages |
debug |
(logical) display additional messages for debugging |
callFrom |
(character) allows easier tracking of messages produced |
Details
By default all columns with text-content may be eliminated to keep the numeric part only, which may then get organized to a 3-dim numeric array (where the additional files will be used as 2nd dimension and multiple columns per file shown as 3rd dimension).
NOTE : (starting from version wrMisc-1.5.5) requires packages readxl and
Rcpp being installed !
(This allows much faster and memory efficient processing than previous use of package 'xlsx
')
Value
This function returns a list of data.frames
See Also
read_excel
; for simple reading of (older) xls-files under 32-bit R one may also see the package RODBC
Examples
path1 <- system.file("extdata", package="wrMisc")
fiNa <- c("pl01_1.xlsx","pl01_2.xlsx","pl02_1.xlsx","pl02_2.xlsx")
datAll <- readXlsxBatch(fiNa, path1)
str(datAll)
## Now let's read all xlsx files of directory
datAll2 <- readXlsxBatch(path=path1, silent=TRUE)
identical(datAll, datAll2)