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/cmd/fwf2table'. Therefore, it will probably only work in a U*ix environment with Perl installed.

Author(s)

Kurt Hornik hornik@ci.tuwien.ac.at

See Also

scan and read.table.

Examples

ff <- tempfile()
##- May only work on Unix: --
system(paste("echo '123456' >", ff))
system(paste("echo '987654' >>", ff))
read.fwf(ff, width=c(1,2,3))	#> 1 23 456 \ 9 87 654
unlink(ff); rm(sys)


[Package Contents]