Overview
As @DavidKlotz commented in the OP, you need to copy the URL of the file of interest; not the URL of the page that hosts the file of interest on GitHub.
Copy the URL from either the Download
button, as shown below, or from the View Raw
hyperlink and paste it into the file
argument within the haven::read_sav()
function in r.
![SS of GitHub]()
# load necessary package
library( haven )
# transform GitHub url
# from 'Download' button
# into data frame
df <- read_sav( file = "https://github.com/sjkiss/CES2015/raw/master/CES2015-phone-release/CES2015_CPS-PES-MBS_complete.sav" )
# view the dimensions
dim( df ) # [1] 4202 454
# transform GitHub url
# from 'View Raw' hyperlink
# into data frame
df <- read_sav( file = "https://github.com/sjkiss/CES2015/blob/master/CES2015-phone-release/CES2015_CPS-PES-MBS_complete.sav?raw=true" )
# view the dimensions
dim( df ) # [1] 4202 454
# end of script #