write.xls: Write to Microsoft Excel XLS file

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Write a matrix or data.frame to a genuine Microsoft Excel XLS file. The first row is bold, italics, dashed underline. Columns are centred.

Usage

1
2
write.xls(x, xls, verbose = FALSE, row.names = FALSE, col.names = TRUE,
  ...)

Arguments

x

either a data.frame, or a list of data.frames. if a list of data.frames, then each data.frame will become a worksheet in the resulting workbook.

xls

the xls file to be created.

verbose

logical: print messages?

row.names

DIFFERENT TO write.table. Can be either TRUE, FALSE, NULL, NA, or a character(1). if TRUE then row.names will be written out, with a blank column header, if FALSE, then no row names will be written out, if NULL or NA, then rownames will be written out with no column name (just like write.table(row.names=TRUE) would do) if row.names is a character vector of length 1, then write the row.names out, and use use the supplied word as the column name for the rownames else error

col.names

logical: If TRUE then write out the column names.

...

additional arguments passed to write.delim

Details

Uses a perl module called Spreadsheet::WriteExcel, by John McNamara, a perl program called tab2xls, based on a program of the same name also by JM. This R code borrows the structure from gdata's excellent read.xls function.

Value

none. writes an excel 'xls' file.

Note

Installation It's not that widely tested, but this package does include the necessary perl libraries to write XLS files. If you're struggling though, install the 'Spreadsheet::WriteExcel' Perl module via CPAN or similar. For OSX users, this involves:
sudo perl -e shell -MCPAN
install Spreadsheet::WriteExcel

Author(s)

Mark Cowley, 2009-01-20

See Also

write.xlsx write.table read.delim read.xls

Examples

1
2
3
4
f <- tempfile(fileext=".xls")
write.xls(iris, f)
x <- list(A=iris[1:5, ], B=iris)
write.xls(x, f)

drmjc/excelIO documentation built on May 15, 2019, 2:22 p.m.