简体   繁体   中英

Not able to load *.Rda file from GitHub in R

I am a newbie in R. I have downloaded a dataset. But I am not able to load it.

file_url<-"https://github.com/TarekDib03/ExploratoryDataAnalysisCoursera/blob/master/maacs.Rda"
download.file(file_url,"macs.rda")
load("macs.rda")

Error:

Error in load("macs.rda") : 
  bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘maacs.Rda’ has magic number ''
  Use of save versions prior to 2 is deprecated 

Try to add ?raw=true to your file_url and then load it inside url() :

file_url <- "https://github.com/TarekDib03/ExploratoryDataAnalysisCoursera/blob/master/maacs.Rda?raw=true"
load(url(file_url))

If you want to download that file to your computer, do that from your browser , otherwise it will not work.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM