Daniel Schwartz
2014-Jun-19 04:31 UTC
[R] Output levels of categorical data to Excel using with()
I have coded qualitative data with many (20+) different codes from a survey in an excel file. I am using the with() function to output the codes so we know what's there. Is it possible to direct the output from with() to an excel file? If not, what's another function that has the same, er, functionality?! Thanks, R World! [[alternative HTML version deleted]]
Marc Schwartz
2014-Jun-19 16:58 UTC
[R] Output levels of categorical data to Excel using with()
On Jun 18, 2014, at 11:31 PM, Daniel Schwartz <das2890 at gmail.com> wrote:> I have coded qualitative data with many (20+) different codes from a survey > in an excel file. I am using the with() function to output the codes so we > know what's there. Is it possible to direct the output from with() to an > excel file? If not, what's another function that has the same, er, > functionality?! Thanks, R World!It is not clear from your description, that the use of with() is really relevant here. with() is typically used as a convenience wrapper to be able to evaluate the names of data frame columns in the environment of the data frame, rather than having to repeat the 'DataFrameName$' prefix over and over. To export data from R to Excel files, there are various options which are listed both in the R wiki: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows and in the R Data Import/Export manual: http://cran.r-project.org/doc/manuals/r-release/R-data.html#Reading-Excel-spreadsheets Worst case, you can use ?write.csv to dump the data to a CSV file, which can then be opened with Excel. The option you may prefer will depend upon your operating system, how comfortable you may or may not be relative to installing additional software, do you want to create a new Excel file with each export or be able to append to existing worksheets and how you may want to structure or format the worksheet(s) in Excel. Regards, Marc Schwartz P.S. I have a cousin Daniel, but different gmail e-mail address.