user10394692
user10394692

Reputation:

Importing CSV files into R

I am trying to import the CSV file directly into my R with the following code:

url <- "https://www.kaggle.com/zusmani/us-mass-shootings-last-50-years/downloads/us-mass-shootings-last-50-years.zip/4"


temp <- tempfile()
download.file(url, temp)
citibike <- read.csv(unz(temp, "Mass-Shootings-Dataset-Ver-5.csv"),
                     stringsAsFactors = FALSE)
unlink(temp)

However I am receiving the following error message:

Error in open.connection(file, "rt") : cannot open the connection
In addition: Warning message:
In open.connection(file, "rt") :
  cannot open zip file 'C:\Users\corey\AppData\Local\Temp\RtmpCMd1pT\file4084193345f6'

What am I doing wrong?

Upvotes: 1

Views: 172

Answers (1)

jmartori
jmartori

Reputation: 424

You could use kaggler to log in.

It also provides functions to get the data and the datasets.

Upvotes: 1

Related Questions