加入r径向外壳命令中的分隔符
function的shell命令功能作为预处理步骤
foods.txt:
ID|FOOD
100000853384|Cheese
100003735682|Potato
100006367485|Apple
100007267644|Beef
food_types.txt:
ID|TYPE
100000853384|Fat
100003735682|Carbohydrate
100006367485|Fruit
100007267644|Protein
。
library(data.table)
foods <- fread(cmd = paste("join -t '|' food_types.txt foods.txt"))
我有两个.txt文件,我想使用r data.table fread 它返回一个错误,说明
''' is not recognized as an internal or external command,
operable program or batch file.
,如果我将定界符更改为逗号,并且使用
foods <- fread(cmd = paste("join -t ',' food_types.txt foods.txt"))
如何使Join与管道定界符配合使用?我在Windows 10 Pro上使用R 4.1.3版。
I have two .txt files that I want to join using the R data.table fread function's shell command feature as a pre-processing step before importing into R. The two files are:
foods.txt:
ID|FOOD
100000853384|Cheese
100003735682|Potato
100006367485|Apple
100007267644|Beef
food_types.txt:
ID|TYPE
100000853384|Fat
100003735682|Carbohydrate
100006367485|Fruit
100007267644|Protein
I tried this code
library(data.table)
foods <- fread(cmd = paste("join -t '|' food_types.txt foods.txt"))
But it returns an error saying
''' is not recognized as an internal or external command,
operable program or batch file.
However, the join works properly if I change the delimiter to a comma and use
foods <- fread(cmd = paste("join -t ',' food_types.txt foods.txt"))
How can I get the join to work with the pipe delimiter? I am using R version 4.1.3 on Windows 10 Pro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以切换双人行情吗?
输出:
Can you switch the double and single quotes?
Output: