read: Reads fixed width files

Description Usage Details

View source: R/read.r

Description

A simple wrapper for the read::read_fwf function vignette("locales")

Usage

1
2
3
read(file, fwf, quiet = FALSE)

fwf(d, cols = NULL, enc = "UTF-8", pin = TRUE)

Details

reading only the necessary columns is much faster than reading the wihole file. This is especially true for dem-file with over 200 columns but also for STD file wich 50 colums

Providing column types gives a significant performance boost.

There are different ways to select columns. read_fwf is not very well documented. If start and end is better than withds and the two hav no performance difference anyway, internally the columns are read with begin and end indices anyway: fwf_widths(c(3,5,7))

Providing column names makes it more flexible to selct columns and has no performance impact

performance tests revealed nor calling any function in read is faster especially locale() is slow

Weardly that was nut true for calling cat(), printing each filename to the console bade the reading a bit faster


rluech/tv-clone documentation built on Jan. 7, 2022, 12:27 a.m.