Description Usage Arguments Value Examples
fread_fwf
takes as basic input a fixed-width filename and its schema and
wraps around fread
from package data.table to provide the
contents of the file.
This method is indeed a wrapper for the function fread
followed by the
application of stri_sub
.
1 2 3 4 | validateValues(object, StfwfSchema, perl = FALSE)
## S4 method for signature 'data.frame,StfwfSchema'
validateValues(object, StfwfSchema, perl = FALSE)
|
object |
Object with rectangular shape whose columns will be validated. |
StfwfSchema |
Object of class StfwfSchema with the schema of object. |
perl |
Logical vector of length 1 with default value |
Returns TRUE
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | path <- system.file('extdata', package = 'fastReadfwf')
stSchema <- fastReadfwf::StxlsxToSchema(
file.path(path, 'SchemaSNHS.xlsx'),
sheetToRead = 'stSchema')
# For data.tables
data <- fread_fwf(
file.path(path, 'MicroDataSNHS.txt'), stSchema, outFormat = 'data.table', perl = TRUE)
validateValues(data, stSchema, perl = TRUE)
# For tibbles
data <- fread_fwf(
file.path(path, 'MicroDataSNHS.txt'), stSchema, outFormat = 'tibble')
validateValues(data, stSchema, perl = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.