write.xls {xlsReadWrite} | R Documentation |
Saves a data.frame, a matrix or a vector as a native Excelfile. The supported format is BIFF8, i.e. Excel v97-2003.
write.xls( x, file, colNames = TRUE, sheet = 1, from = 1 )
x |
a data.frame, a matrix or a vector of the types double, integer, logical or character. |
file |
the name of the file |
sheet |
to write into. Either a number (starting from 1) or a character string naming the sheet. If no sheet with this name is found, a new one will be inserted at the first position. |
colNames |
indicates if a header row should be written in Excel. Either a logical value (the columnnames or default values are taken) or or a character vector with userdefined column names. |
from |
specifies the first row to write to in Excel (slightly different from the pro version where the upper left corner (row/col) can be indicated). |
Any new files are based on the template TemplateNew.xls
which can be
adapted to your specific needs. The file has to be in the same folder as the DLL
(normally R_HOME/library/xlsReadWrite/libs).
For data.frames there is an auto-row feature: if the first entry in rownames is not "1" a rowname-column will be written in Excel.
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