我正在尝试在 R 中传输两个 bash 命令,但出现管道损坏错误;任何建议表示赞赏。这就是我所在的位置:
#Create a long file (2GB on your drive...)
write.csv(rep(1,1E8),file="long.txt", row.names=FALSE)
system("grep 1 tmp.txt") #This works
system("grep 1 tmp.txt| head -n 10") #This gives a broken pipe error
我得到 grep: writing output: broken pipe 用一个短文件可以正常工作。请问我该如何解决这个问题?
谢谢。