Last data update: 2014.03.03

R: Export multiple R data sets to Excel
excel_exportR Documentation

Export multiple R data sets to Excel

Description

Exports a single data frame or a list of data frames to one or multiple excel sheets using the function write.xlsx frome the xlsx package. This function just add an option to write.xlsx so it can write multiple data frames with a single command .It can write both .xls and .xlsx files.

Usage

excel_export(x,file,table_names=as.character(1:length(x)),row.names=F,...)

Arguments

x

Either a data frame or a list containing multiple data frame to be exported.

file

The name of the file we want to create.

table_names

A character or a vector character containing the names that will receive the sheet where the data frame is stored. If it is a vector, it must follow the same order as the data frames in x have. All names must be different from each others.

row.names

see write.xlsx.

...

see write.xlsx.

Value

No value is returned.

Note

This function requires Java, read the corresponding section of the write.xlsx help to see the details.

See Also

read.xlsx, write.xlsx

Examples


## Not run: 
# x is a data.frame
file<-("mydata.xlsx")
a<- 1:10
b<-rep("b",times=10)
c<-rep(1:2,each=5)
x<-data.frame(a,b,c)
excel_export(x,file,table_names="mydata")
# x is a list
y<-list(x,x[2:3])
excel_export(y,file,table_names=c("mydata1","mydata2"))

## End(Not run)

Results