read.xls {xlsReadWrite} | R Documentation |
Natively reads an Excelsheet and creates a data.frame or a matrix from it. The supported format is BIFF8, i.e. Excel v97-2003.
read.xls( file, colNames = TRUE, sheet = 1, type = "data.frame", from = 1 )
file |
the name of the file to read from. |
colNames |
indicates if there is a header row in Excel. Either a logical value or a character vector with user defined column names. |
sheet |
to read from. Either a number (starting from 1) or a character string naming the sheet. |
type |
specifies the type of the return value. Either data.frame
or the entries double , integer , logical or
character which give back a matrix. |
from |
specifies the first row to start reading. Depending on the value
of colNames this is the header row or the first data row. (Slightly
different from the pro version where the upper left corner (row/col) can be
indicated). |
For data.frames there is an auto-row feature. Provided the following two conditions are met, a column is taken as the rownames: 1) colNames is TRUE or has values where the first entry is empty and 2) in the Excel table the first entry of the header is empty.
A data.frama or a matrix containing the data.
Besides the free open source version there is a shareware version which
is formally supported and offers some more features, e.g.:xls.sheet
:
insert, delete, rename and select sheets, directly address sectors (columns,
rows or cells) in Excel, xls.open
and xls.close
keep the
connection in memory and avoid the overhead to re-read the whole file for
subsequent actions. colClasses
supports classes and rownames.
Why not check out xlsReadWritePro? It's free to try and - besides donations (hint, hint...) - also a good way to support my work. Infos, updates, bugfixes etc, see: http://treetron.googlepages.com
Hans-Peter Suter
write.xls
,
read.table
, matrix
, data.frame