如何使用 R 读取 RData 文件

How to read RData file with R

如何使用 httr 读取 RData?我尝试了几件事,但出现错误

a)

download.file(downloadURL, "temp.rData")
load("temp.rData")

b)

bin = getBinaryURL(downloadURL, ...yourOtherParams...) 
writeBin(bin, "temp.rData")  
load("temp.rData")

来自线程 Download .RData and .csv files from FTP using RCurl (or any other method)

并且还使用 httr

c)

  a=GET("https://github.com/tvganesh/yorkrData/blob/master/IPL/IPL-T20-matches/Chennai%20Super%20Kings-Deccan%20Chargers-2008-05-06.RData")
  writeBin(a$content,"aa.RData")
  load("aa.RData")

但我收到错误

 Error: bad restore file magic number (file may be corrupted) -- no data loaded
 In addition: Warning message:
  file ‘t.rData’ has magic number '<'
  Use of save versions prior to 2 is deprecated

我该如何解决这个问题?

谢谢 象头神

这对我有用:

load(url("https://github.com/tvganesh/yorkrData/raw/master/IPL/IPL-T20-matches/Chennai%20Super%20Kings-Deccan%20Chargers-2008-05-06.RData"))

我从 RData 文件中得到一个数据帧overs
url 取自 github 页面的下载按钮以获取原始文件。