【问题标题】:read.xls (gdata) - from an https urlread.xls (gdata) - 来自 https url
【发布时间】:2014-06-25 06:18:03
【问题描述】:

我正在尝试从 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' 中的 's' 是必需的。

【问题讨论】:

  • 用浏览器下载。然后从磁盘读取它。
  • 这需要是一个完全自动化的过程。我可以使用系统(“wget file dest”)下载文件,但不希望这样做。
  • R 在调用file() 时遇到https:// 的问题。您需要进一步解释为什么您的“偏好”令人信服

标签: r https gdata


【解决方案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)

【讨论】:

  • ... 或 method="wget"
  • 谢谢。效果很好。
猜你喜欢
  • 2018-10-05
  • 1970-01-01
  • 2016-10-08
  • 1970-01-01
  • 2018-07-17
  • 2014-03-11
  • 2021-12-28
  • 2012-10-30
  • 2013-09-05
相关资源
最近更新 更多