Watts-College / paf-514-template

https://watts-college.github.io/paf-514-template/
1 stars 0 forks source link

Lab 3 dataset access #14

Closed mbrentli closed 10 months ago

mbrentli commented 1 year ago

I am suddenly having trouble accessing the dataset in Lab 3.

I had previously accessed it fine, and was about 75% of the way through the lab, but when I went back in later today, and started running chunks one by one, I am getting an error. I am just using the code provided in the Lab Instructions:

#Load dataset:

# URL <- "https://www.dropbox.com/s/tizgdsat2mziod6/medium-data-utf8.csv?dl=1"
URL <- "https://raw.githubusercontent.com/DS4PS/cpp-527-fall-2020/master/labs/data/medium-data-utf8-v2.csv"
d <- read.csv( URL )

preview.these <- c("title", "subtitle", "claps", "reading_time", "publication", "date")
head( d[preview.these] ) %>% pander()

Here is the error that it produces: Error in file(file, "rt") : cannot open the connection to 'https://raw.githubusercontent.com/DS4PS/cpp-527-fall-2020/master/labs/data/medium-data-utf8-v2.csv'

I noticed when I ctrl+clicked on the url, it changed the address slightly, so I tried with that address as well - didn't work.

I tried saving, closing, and restarting R, but it's still producing the error.

lecy commented 1 year ago

It’s odd that it was working then stopped. Microsoft bought GitHub and they have been making lots of changes so without knowing the real cause I’m going to blame them. The raw link option seems to be disappearing from a lot of files. When I follow the link to the lab dataset it gives me a download prompt instead of taking me to the raw file. I suspect that’s the issue.

A pretty straight-forward workaround is to download the file and read your local copy. The code is explained here:

https://statisticsglobe.com/download-file-in-r-example/

I’ll get the read.csv option working when I’m back online.

mbrentli commented 1 year ago

Thanks. It seems to be working again this morning - at the moment, anyway. I'll do the local copy method as a backup, though.

lecy commented 1 year ago

Let's assume it was a server update and the file was unavailable, or a poor internet connection.

If that one stops working, here is a backup copy:

url <- "https://raw.githubusercontent.com/Watts-College/paf-514-template/main/labs/data/medium-data-utf8-v2.csv"
d <- read.csv( url )