[英]How to read RData file with R
How can I read RData with httr? 如何使用httr读取RData? I tried a couple of things but I got error
我尝试了几件事,但出现错误
a) 一种)
download.file(downloadURL, "temp.rData")
load("temp.rData")
b) b)
bin = getBinaryURL(downloadURL, ...yourOtherParams...)
writeBin(bin, "temp.rData")
load("temp.rData")
from thread Download .RData and .csv files from FTP using RCurl (or any other method) 从线程使用RCurl(或任何其他方法)从FTP下载.RData和.csv文件
and also using httr 并使用httr
c) 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")
but I get the error 但是我得到了错误
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
How can I fix this? 我怎样才能解决这个问题?
Thanks Ganesh 感谢Ganesh
This worked for me: 这对我有用:
load(url("https://github.com/tvganesh/yorkrData/raw/master/IPL/IPL-T20-matches/Chennai%20Super%20Kings-Deccan%20Chargers-2008-05-06.RData"))
I get a dataframe overs
from the RData-file. 我得到一个数据框
overs
从RDATA文件。
The url is taken from the Download-button of the github-page to get the raw file. 该URL从github页面的下载按钮获取,以获取原始文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.