fast.read.fwf {mvbutils}R Documentation

Read in fixed-width files quickly

Description

Experimental replacement for read.fwf that runs much faster. Included in mvbutils only to reduce dependencies amongst my other packages.

Usage

fast.read.fwf(file, width,
    col.names = if (!is.null(colClasses))
        names( colClasses) else "V" %&%  1:ncol(fields),
    colClasses = character(0), na.strings = character(0L),  tz = "", ...)

Arguments

file

character

width

vector of column widths. Negative numbers mean "skip this many columns". Use an NA as the final element if there are likely to be extra characters at the end of each row after the last one that you're interested in.

col.names

names for the columns that are NOT skipped

colClasses

can be used to control type conversion; see read.table. It is an optional vector whose names must be part of col.names. There is one extension of the read.table rules:a colClass string starting POSIXct. will trigger automatic conversion to POSIXct, using the rest of the string as the format specifier. See also tz.

na.strings

are there any strings (other than NA) which should convert to NAs?

tz

used in auto-conversion to POSIXct when colClass is set

...

ignored; it's here so that this function can be called just like read.fwf

Value

A data.frame, as per read.fwf and read.table. misc


[Package mvbutils version 2.8.232 Index]