Writing a group of R data.frames to named Excel Worksheets

First install “WriteXLS” library in R using:

source("http://bioconductor.org/biocLite.R")
biocLite("WriteXLS")

Now if I have 3 data.frames called “genes”, “proteins” and “elephants”, all I need to do to write them to the same Excel file, on different *named* worksheets is:

library("WriteXLS")
WriteXLS(c("genes", "proteins", "elephants"), "WriteXLS.xls")

Note, for this to work, Perl needs to be installed. You also need the “Text::CSV_XS.pm” library. On Ubuntu this can be installed by issuing the command:

sudo apt-get install libtext-csv-xs-perl

Leave a Reply