问题描述
使用多个工作表将大型Excel电子表格转换为R中的.CSV文件,最简单的方法是什么?
What is the simplest way to convert a large Excel spreadsheet with multiple worksheets into .CSV files in R?
请注意,我已经测试过XLConnect和XLSX,发现我的Excel表导致崩溃。所以我特别寻找一个不使用XLConnect或XLSX软件包的解决方案。
Note that I've tested XLConnect and XLSX and found that my Excel sheets cause it to crash. So I'm specifically looking for a solution that does not use the XLConnect or XLSX package.
推荐答案
编辑:解决read.xlsx选项:
to address the read.xlsx option:
如果您运行Perl,则需要一个当前版本的gdata
If you have Perl running, you need a current version of gdata
require(gdata)
installXLSXsupport() #now the example from help(read.xls)
# load the third worksheet, skipping the first two non-data lines...
if( 'XLSX' %in% xlsFormats() ) # if XLSX is supported..
data <- read.xls(exampleFile2007, sheet="Sheet with initial text", skip=2)
data
#-----------------------
X X.1 D E. F G Factor
1 NA FirstRow 1 NA NA NA Red
2 NA SecondRow 2 1 NA NA Green
3 NA ThirdRow 3 2 1 NA Red
4 NA FourthRow 4 3 2 1 Black
#------------------------
write.csv(data)
这是在Mac上完成的,直到这个问题我一直绊倒在installXLSXsupport()阶段,因为我总是发生错误。这一次,我从终端命令行启动了Perl,并在首次设置我的个人配置,在我的大陆定义了CPAN镜像,并且我离开了perl运行后获得了成功。
This was done on a Mac and up until this question I had always stumbled at the installXLSXsupport() stage since I always got an error. This time I started up Perl from a Terminal command line, and got success after first setting up my personal configuration, defining CPAN mirrors on my continent, and I left perl running.
这篇关于将Excel电子表格保存为.csv与R?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!