load.data: Loads data from multiple CSV files and combines the data into...

Description Usage Arguments Value Examples

Description

This function searches for CSV files matching a pattern in the given path and combines all the data into a data.table object. The number of capture groups in the regular expression (pattern) must match the number of fields.

Usage

1
2
load.data(path, pattern, fields, local.func = NULL, global.func = NULL,
  fill = FALSE, ...)

Arguments

path

Path where to search for the CSV files.

pattern

Regular expression used to search the CSV files and extract the fields values too.

fields

Fields that uniquely identify the data from a CSV file.

local.func

Custom function to be called after reading a single CSV file. Defaults to NULL.

global.func

Custom function to be called after all the data tables have been merged into a single one. Defaults to NULL.

fill

Whether to fill missing columns due to inconsistent CSV files.

...

Arguments to pass to data.table::fread().

Value

A data.table object containing the data read from the CSV files.

Examples

1
2
3
4
## Not run: 
load.data('.', 'results-(\\d+)-(\\w+)\\.csv', c('ID', 'config'))

## End(Not run)

betabandido/exptools documentation built on May 12, 2019, 7:25 p.m.