djc55
djc55

Reputation: 555

Problems reading a .zip file in R

I am trying to unzip a .zip of Formula 1 data from this website using the following code:

dat <- unzip(zipfile = "http://ergast.com/downloads/f1db_csv.zip")

However, each time I do so I get the following error message:

error 1 in extracting from zip file

Can anybody tell me what I am doing wrong?

Upvotes: 0

Views: 130

Answers (1)

G5W
G5W

Reputation: 37661

I think that unzip will only work with local files, not URLs. You can make this work by downloading first.

download.file("http://ergast.com/downloads/f1db_csv.zip", "f1db_csv.zip")
unzip("f1db_csv.zip")

Upvotes: 1

Related Questions