在文件(文件,“ rt”)中出现错误:无法打开连接

时间:2018-10-19 10:06:12

标签: r connection zip read.table

我正在尝试从Google专利批量数据网站http://storage.googleapis.com/patents/grantbib/2014/ipgb20140107_wk01.zip下载一个zip文件,解压缩该文件并阅读表格。我使用了以下过程Using R to download zipped data file, extract, and import data

setwd("/var/folders/gk/n1wfrbqx6ss4x3vz7qp9lf3c0000gn/T//RtmpG7LUSs")
temp <- tempfile() 
download.file("http://storage.googleapis.com/patents/grantbib/2014/ipgb20140107_wk01.zip",temp)
data <- read.table(unz(temp, "ipgb20140107_wk01.dat"))
unlink(temp)

并且我试图将工作目录设置为与临时文件相同的位置,类似于此处Getting error in file(file, "rt"): cannot open the connection中的建议,但是我仍然收到相同的错误消息:

    Error in open.connection(file, "rt") : cannot open the connection
In addition: Warning message:
In open.connection(file, "rt") :
  cannot locate file 'ipgb20140107_wk01.dat' in zip file '/var/folders/gk/n1wfrbqx6ss4x3vz7qp9lf3c0000gn/T//RtmpG7LUSs/file476796049c7'

0 个答案:

没有答案