简体   繁体   English

读取 R 中的 a.zip 文件时出现问题

[英]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:我正在尝试使用以下代码从本网站解压缩一级方程式数据的 a.zip:

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?谁能告诉我我做错了什么?

I think that unzip will only work with local files, not URLs.我认为 unzip 仅适用于本地文件,而不适用于 URL。 You can make this work by downloading first.您可以通过先下载来完成这项工作。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM