[R] "easiest" way to write an R dataframe to excel?
Marc Schwartz
marc_schwartz at me.com
Mon Aug 23 22:52:37 CEST 2010
On Aug 23, 2010, at 2:50 PM, Eva Nordstrom wrote:
> I am using R 2.11.1 in a Microsoft Windows 7 environment.
>
> I tried using WriteXLS, but get the message " In system(cmd) : perl not found"
>
> What is the "easiest" way to write an R dataframe to Excel? (I am familiar with
> WriteXLS, but I do not have PERL installed, and if not needed, do not wish to
> install it.)
>
> I am also familiar with write.table, but if possible, wish to create an excel
> file form within R.
>
> I'm unsure if this is possible, or perhaps i should just go ahead and install
> PERL...?
There is a page in the R Wiki that provides an overview of your options:
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows
If you just need to do this once or just with a single data frame and writing the data frame to a CSV file and then opening the CSV file in Excel is satisfactory from a process/time standpoint, then using ?write.table might be the best approach.
On the other hand, if you are writing a number of data frames to a single Excel file and perhaps need to do this with some frequency, you will want to consider one of the other, more automated, approaches where you can create an Excel file directly from within R.
If you wish to use WriteXLS, there is an INSTALL file that you can review online (also in the package installation folder):
http://cran.r-project.org/web/packages/WriteXLS/INSTALL
The easiest way to install Perl on Windows, that also has the Perl modules required for WriteXLS, is to use the ActiveState Perl distribution, available from:
http://www.activestate.com/activeperl/
If you have problems or other questions with respect to WriteXLS, let me know.
HTH,
Marc Schwartz
More information about the R-help
mailing list