我试图出口一串数据帧的使用write.xls
功能R中脱颖而出使用使用Windows 7(用R)write.xls导出数据帧到Excel
期望的结果:所选数据帧应该被出口至R
Error Message: [1] "Does 'python' exist, and is it in the path?"
重复性代码:
purchase_year <- c(2007,2007,2007,2008,2008,2008,2009,2009,2009,2009,2009)
sold_year <- c(2007,2008,2009,2009,2010,2011,2009,2010,2011,2012,2013)
units <-c(1,4,4,8,3,1,3,1,1,0,2)
df <- data.frame(purchase_year,sold_year,units)
library(dataframes2xls)
write.xls(df,"C:/WORK/OUTPUT.xls", sh.names = "default", formats = "default",
t.formats = FALSE, fnt.metr = "default",
col.widths = 48, col.names = TRUE, row.names = FALSE,
to.floats = "default", python = "python",
py.script = "default", sh.return = FALSE)
其他信息:
- 我的工作在32位的Windows 7机器
- 安装了Python 3.2.2以及
- 通过write.xls的文档
- 没有尽全力去寻找了这个和其他论坛
- 尝试,包括在Python参数蟒蛇“EXE”的URL,即力更好地工作,
因为我会在多个工作表中写出多个工作表,CSV看起来并不像在这一点上的一个选项时间。
感谢您的帮助,这个问题一直议决
SOLUTION
- 确保安装Python的正确版本。 dataframes2xls旨在与Python 2.x一起使用。我使用了2.7.5
- 我的系统中的Python安装无法被R访问。我尝试了David Marx所描述的步骤,我在这里引用:尝试进入命令提示符并运行命令python。如果返回一个错误,你需要把路径添加到python的可执行文件到PATH环境变量:computerhope.com/issues/ch000549.htm
还有其他用于编写Excel文件的选项,最受欢迎的是** xlsx **和** XLConnect **软件包。 – joran
谢谢@joran会尝试这些以及 –
@joran是否有可能演示如何使用xlsx做到这一点? –