write.xlsx {xlsx} | R Documentation |
Write a data.frame
to an Excel 2007 workbook.
write.xlsx(x, file, sheetName="Sheet 1", formatTemplate=NULL, col.names=TRUE, row.names=TRUE)
x |
a data.frame to write to the workbook. |
file |
the absolute path to the file which the data are to be read from. |
sheetName |
a character string with the sheet name. |
formatTemplate |
Not implemented now. A way for specifying the formatting of the table. |
col.names |
a logical value indicating if the column names of
x are to be written along with x to the file. |
row.names |
a logical value indicating whether the row names of
x are to be written along with x to the file. |
This function provides a high level API for writing a data.frame
to an Excel 2007 worksheet. It calls several low level functions in the
process. Its goal is to provide the conveniency of
write.csv
by borrowing from its signature.
Internally, there is a double loop in R over all the elements of the
data.frame
so performance for very large data.frame
may be
an issue. Please report if you experience slow performance. Dates and
POSIXct classes are formatted separately after the insertion. This also
adds to processing time.
Adrian Dragulescu
read.xlsx
for reading xlsx
documents.
See also saveWorkbook
for reading a workbook into R for
further processing and saveWorkbook
for saving a
workbook to file.
## Not run: file <- paste(tempdir(), "/usarrests.xlsx", sep="") res <- write.xlsx(USArrests, file) ## End(Not run)