read.fwf {base} | R Documentation |
Read a ``table'' of fixed width formatted data
into a data.frame
.
read.fwf(file, widths, sep=" ", as.is = FALSE, skip = 0, row.names, col.names)
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 . |
A data.frame
as by read.table
which is called internally.
This function currently relies on the Perl
script
`$R_HOME/bin/fwf2table'.
Therefore, it will only work in an environment with
Perl 5
installed, see `INSTALL' in the top-level directory
of the sources.
Kurt Hornik hornik@ci.tuwien.ac.at
scan
and read.table
.
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)