readTabulatedBatch: Batch reading of Tabulated Text-Files

View source: R/readTabulatedBatch.R

readTabulatedBatchR Documentation

Batch reading of Tabulated Text-Files

Description

This function allows batch reading of multiple tabulated text files n batch. The files can be designed specifically, or, alternatively all files from a given directory can be read. If package data.table is available, faster reading of files will be performed using the function fread.

Usage

readTabulatedBatch(
  query,
  path = NULL,
  dec = ".",
  header = "auto",
  strip.white = FALSE,
  blank.lines.skip = TRUE,
  fill = FALSE,
  filtCol = 2,
  filterAsInf = TRUE,
  filtVal = 5000,
  silent = FALSE,
  callFrom = NULL,
  debug = FALSE
)

Arguments

query

(character) vector of file-names to be read, if "." all files will be read (no matter what their extension might be)

path

(character) path for reading files, if NULL or NA the current directory will be used

dec

(character, length=1) decimals to use, will be passed to fread or read.delim

header

(character, length=1) path for reading files, if NULL or NA the current directory will be used, will be passed to fread or read.delim

strip.white

(logical, length=1) Strips leading and trailing whitespaces of unquoted fields, will be passed to fread or read.delim

blank.lines.skip

(logical, length=1) If TRUE blank lines in the input are ignored. will be passed to fread or read.delim

fill

(logical, length=1) If TRUE then in case the rows have unequal length, blank fields are implicitly filled, will be passed to fread or read.delim

filtCol

(integer, length=1) which columns should be used for filtering, if NULL or NA all data will be returned

filterAsInf

(logical, length=1) filter as inferior or equal (TRUE) or superior or equal threshold filtVal

filtVal

(numeric, length=1) which numeric threshold should be used for filtering, if NULL or NA all data will be returned

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of messages produced

debug

(logical) display additional messages for debugging

Details

If you want to provide a flexible pattern of ffile-names, this has to be done before calling this usntion, eg using grep to provide an explicit collection of flles. However, it is possible to read different files from different locations/directories, the length of path must match the length of query

Value

This function returns a list of data.frames

See Also

fread, read.delim, for reading batch of csv files : readCsvBatch

Examples

path1 <- system.file("extdata", package="wrMisc")
fiNa <-  c("a1.txt","a2.txt")
allTxt <- readTabulatedBatch(fiNa, path1)
str(allTxt)


wrMisc documentation built on Nov. 17, 2023, 5:09 p.m.