[R] Writing a data frame in an excel file
anna_l
lippelanna21 at hotmail.com
Wed Nov 18 16:41:31 CET 2009
Hi Charlie, I´ve been trying to use the sqlSave the way you showed me but it
would give me this error message which I couldn´t solve:
Erro em sqlSave(xlsFile, strategy, tablename = "Result", rownames = FALSE) :
table ‘Result’ already exists
I would like to save the data frame in a specified worksheet but I couldn´t
find in the help on sqlSave how to do it.
cls59 wrote:
>
>
> 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
>
-----
Anna Lippel
new in R so be careful I should be asking a loooooooot of questions!:teeth:
--
View this message in context: http://old.nabble.com/Writing-a-data-frame-in-an-excel-file-tp26378240p26408412.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list