Read Fixed Width Format Files

Usage

read.fwf(file, widths, sep=" ", as.is = FALSE,
         skip = 0, row.names, col.names)

Arguments

file the name of the file which the data are to be read from. Each row of the table appears as one line of the file.
widths integer vector, giving the widths of the fixed-width fields (of one line).
sep character; the separator used internally; should be irrelevant.
as.is see read.table.
skip number of initial lines to skip; see read.table.
row.names see read.table.
col.names see read.table.

Description

Read a ``table'' of fixed width formatted data into a data.frame.

Value

A data.frame as by read.table which is called internally.

Note

This function currently relies on the Perl script `$RHOME/bin/fwf2table'. Therefore, it will only work in an environment with Perl installed.

Author(s)

Kurt Hornik hornik@ci.tuwien.ac.at

See Also

scan and read.table.

Examples

ff <- tempfile()
cat(file=ff, "123456", "987654", sep="\n")
read.fwf(ff, width=c(1,2,3))	#> 1 23 456 \ 9 87 654
unlink(ff)


[Package Contents]