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

Viewed 427

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 
1 Answers

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.

Related