read.xls(gdata) - 来自https网址

时间:2014-05-08 02:49:36

标签: r https gdata

我试图从URL读取excel文件: https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls

我可以下载该文件,并使用gdata包中的read.xls读取它没问题。

但是我在尝试直接阅读时遇到错误。

    Unable to open file 'https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls'.
    Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method,  : 
      Intermediate file '/tmp/RtmptxiYS1/file42f8532a0129.csv' missing

我试过这个: Importing Excel file using url using read.xls但是'在' https'是必须的。

1 个答案:

答案 0 :(得分:1)

试试这个

library(gdata)
tmp <- tempfile()
download.file("https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls", 
              destfile=tmp, method="curl")

read.xls(tmp, skip=2)
unlink(tmp)