首页 > 解决方案 > 用 7z 读取压缩文件

问题描述

我想用freadR 读入一个文件。我已经7z安装了。

我试过了

fread(shell(cmd = '7z l test.txt.gz'), shell = 'cmd.exe'))

但是我得到了错误

Error in fread(shell(cmd = paste0("7z x ", "\"", dest, "\""), shell = "cmd.exe")) : 
  'input' must be a single character string containing a file name, a command, full path to a file, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or the input data itself

我正在寻找类似的东西:

 fread(shell(cmd = 'unzip -cq test.zip', shell = 'cmd.exe'))

标签: rwindowsdata.table7zip

解决方案


一种解决方法是复制7z.exe到项目文件夹。并尝试:

DT = fread(cmd = '7z e -so "test.zip"')

有人建议将 7-zip 添加到 Windows PATH 环境变量中。但这对我不起作用。


推荐阅读