StfwfSchema-class: S4 class for the standard data.frame for a fixed-width file...

Description Slots Examples

Description

Definition of the S4 class named StfwfSchema for the data.frame providing the schema of the fixed-width file to read.

Slots

df

data.frame with 5 columns:

  • variable: the name of the variable.

  • width: the number of positions which the values of this variable occupies in the file.

  • initialPos: initial position of the field whic hthe values of this variable occupies in the file.

  • finalPos: final position of the field whic hthe values of this variable occupies in the file.

  • type: type of the variable. It must be either num or char.

  • valueRegEx: regular expression for the values of this variable.

  • description: textual description of the variable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# An empty StfwfSchema object:
new(Class = 'StfwfSchema')

# 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)
new(Class = 'StfwfSchema', df = df)

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