sub-StfwfSchema-method: Extract parts of an object of class StfwfSchema

Description Usage Arguments Value Examples

Description

[ extracts parts of an object of class StfwfSchema.

It is indeed the method [ for the class StfwfSchema. This method returns subsets of the slot df from an object of class StfwfSchema specified as an input parameter. The output is an object of the same class StfwfSchema as the input parameter x.

Usage

1
2
## S4 method for signature 'StfwfSchema'
x[i, j, ..., drop = TRUE]

Arguments

x

Object of class StfwfSchema.

i, j, ...

Indices corresponding to elements to be extracted. The indices are numeric or character vectors, missing or NULL. Numeric values are coerced to integer with as.integer (thus truncated to zero).

drop

Included by coherence.

Value

Object of class StfwfSchema with the subsetted input object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# A trivial example:
df <- data.frame(variable = c('Turnover', 'Employees'),
                 width = c(9L, 3L),
                 initialPos = c(1, 10),
                 finalPos = c(9, 12),
                 type = rep('num', 2),
                 valueRegEx = c('[0-9]{0,9}', '[0-9]{0,3}'),
                 description = c('Turnover of the business unit',
                                 'Number of employees of the business unit'),
                 stringsAsFactors = FALSE)
Schema <- new(Class = 'StfwfSchema', df = df)
Schema[variable == 'Turnover', ]
Schema[1, 'valueRegEx']

david-salgado/fastReadfwf documentation built on Dec. 25, 2021, 12:43 p.m.