读取带有fread的zpiptip folde的txt文件,而无需在r中解压缩
我正在尝试在一个有两个文件夹的压缩文件夹中读取TXT文件。
数据(主文件夹)
- 河(子文件夹)
- 处理(子文件夹)
在河中我有很多TXT格式的文件,我正在使用以下代码来阅读它们。
df <- fread(cmd = 'unzip -p Data.zip river//Main.txt',
select = c(1,2,5,25),
sep = '|',
header = FALSE,
stringsAsFactors = FALSE,
quote = "")
但是,这导致0个观察结果,我会收到以下错误:
谨慎:文件名不匹配:river // main.txt
I am trying to read TXT files in a compressed folder with two folders inside.
Data (main folder)
- river (subfolder)
- treatment (subfolder)
Inside river I have many files in txt format and I am using the following code to read them.
df <- fread(cmd = 'unzip -p Data.zip river//Main.txt',
select = c(1,2,5,25),
sep = '|',
header = FALSE,
stringsAsFactors = FALSE,
quote = "")
However, this results in 0 observations and I am getting the following error:
caution: filename not matched: river//Main.txt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑您需要做的就是从路径上删除双重斜线。
可重现的示例:
带双斜线:
修复该问题并有效:
I suspect all you need to do is remove the double-slash from your path.
Reproducible example:
With double-slashes:
Fix that and it works: