将CSV文件导入到R

将CSV文件导入到R,r,R,我正在尝试使用以下代码将CSV文件直接导入到我的R中: 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-

我正在尝试使用以下代码将CSV文件直接导入到我的R中:

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)
我做错了什么

您可以使用登录


它还提供了获取数据和数据集的函数

您确定可以正确下载zip文件吗?当我试图通过网络浏览器下载它时,页面显示了一个auth。图层(使用您的Kaggle用户名或电子邮件)。我想你甚至不能把zip文件下载到你的电脑上。因为你面临的错误告诉了它。所以似乎下载文件需要一个帐户,我如何使用R登录到该站点?这可能会解决问题。下载的文件是HTML文件,而不是zip文件。这就是您的错误:
无法打开zip文件
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'