【发布时间】:2016-10-08 21:13:18
【问题描述】:
我在这里看到了很多关于使用带有 url 的 read.xls 的帖子,它们都在我的 Mac 上运行,但是现在当我尝试在我的 Windows 计算机上使用代码时,它不起作用。我在我的 Mac 上使用了以下代码:
tmp <- tempfile()
download.file("https://www.spdrs.com/site-content/xls/SPY_All_Holdings.xls?fund=SPY&docname=All+Holdings&onyx_code1=1286&onyx_code2=1700", destfile = tmp, method = "curl")
SPY <- read.xls(tmp, skip=3)
unlink(tmp)
不再使用“curl”(“had status 127”是警告消息),当我尝试“internal”或“wininet”时,它显示“formal argument”method”matched by multiple actual arguments”。当我尝试 read.xls 时,它说文件“丢失”和“无效”。我已经下载了 Perl、Java、gdata、Rcurl 和“下载器”包(因为我听说它与 https 配合得更好)并且可以使用它来代替....在 Windows 计算机上我还需要做些什么吗?这段代码有效吗?
谢谢!
【问题讨论】:
-
data<- read.xls(file.choose(),perl="C:/Perl64/bin/perl.exe")在read.xls函数的perl参数中找到您的perl.exe文件。对于read.xls()函数,您需要在R 中安装gdata()包。为perl.exe 路径设置环境变量也会有所帮助。 -
给我们命令直到现在你尝试了 WIndows 机器及其输出或它抛出的错误..
-
我看到了这个链接。看看这是否有帮助:stackoverflow.com/questions/21738463/…
-
@SowmyaS.Manian 我看到了这个问题,并认为这意味着手动将 https 更改为 http。理想情况下,我正在尝试使整个过程自动化
-
stackoverflow.com/questions/24165623/… 此处找到的代码有效!