matrixFromDatedFiles: Matrix from dated files

Description Usage Arguments Details Value Examples

Description

Create a single matrix from data in separate (dated) files.

Usage

1
matrixFromDatedFiles(fls, dir, filePat = "*", col = 1, ...)

Arguments

fls

Files (character) to process

dir

Directory (character)

filePat

File pattern (regexpr)

col

Column description (integer or character)

...

Additional arguments passed to read.table

Details

This is a general-purpose function to parse dated files to a data matrix. There's nothing here about the file-naming convention; that's the responsibility of the caller. (Columns get labelled exactly like the input files). Missing data padded w/ 'NA'. Load data from columns in the dated files. Can either specify files directly or specify a directory 'dir' and file-pattern 'filePat' (regexpr). Column description 'col', which can be either an integer column index or a character which will be passed to grep to match a column header. Arguments like 'skip', 'header', 'sep' & 'stringsAsFactors' are passed to 'read.table'.

This is a general-purpose function to parse dated files to a data matrix. There's nothing here about the file-naming convention; that's the responsibility of the caller. (Columns get labelled exactly like the input files).

Value

A matrix

Examples

1
2
3
4
## Not run: 
dat <- matrixFromDatedFiles('data', 'dat*', sep=",", header=T)

## End(Not run)

pchristi99/pcLib documentation built on June 25, 2019, 2:23 p.m.