Message-ID: <26378547.post@talk.nabble.com>
Date: 2009-11-16T20:06:05Z
From: Charlie Sharpsteen
Subject: Writing a data frame in an excel file
In-Reply-To: <26378240.post@talk.nabble.com>
anna_l wrote:
>
> Hello, I am having trouble by using the write.table function to write a
> data frame of 4 columns and 7530 rows. I don?t know if I should just use
> a sep="\n" and change the .xls file into a .csv file. Thanks in advance
>
Base R cannot write .xls files by it's self. You should output CSV using
write.csv():
write.csv( dataFrame, file = 'results.csv' )
If you are using R on windows, then the RODBC package provides a mechanism
for dumping data frames directly to Excel files, possibly with multiple
sheets:
require( RODBC )
xlsFile <- odbcConnectExcel( 'results.xls', readOnly = F )
sqlSave( xlsFile, dataFrame, tablename = 'R Results', rownames = F )
odbcCloseAll()
The tablename argument to sqlSave allows you to assign a name to the excel
sheet that will contain the data.frame.
-Charlie
-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
--
View this message in context: http://old.nabble.com/Writing-a-data-frame-in-an-excel-file-tp26378240p26378547.html
Sent from the R help mailing list archive at Nabble.com.