What's a robust method in R for importing from and exporting data to Excel?

余生长醉 提交于 2019-12-06 03:40:44

I've used the technique described here: Export Data Frames To Multi-worksheet Excel File

The R Data Import/Export manual should be considered the best source of advice for these questions.

For reading you can indeed use the RODBC package. An easier solutoion may be read.xls() from the gdata

For writing you can use one of the wrapper packages such as WriteXLS which wraps around Perl libraries that know how to write in the proprietary and not formally documented xls format.

In general, xlsx will not be a solution as this format is newer, once again proprietary and not documented. For that reason there are even fewer tools coping with this.

Jeromy Anglim

XLConnect works well. It is cross-platform. It can read and write xls and xlsx files. See this previous answer

This question is 3 years old, but I'll throw this in: if you want to write to the spreadsheet, remember to add readOnly=FALSE as an argument to odbcConnectExcel and odbcConnectExcel2007.

There is a package that may help with dealing with excel 2007, but I haven't tried it.

http://www.omegahat.org/RExcelXML/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!