Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在R中运行shell脚本并将输出放入表中?_R_Shell - Fatal编程技术网

如何在R中运行shell脚本并将输出放入表中?

如何在R中运行shell脚本并将输出放入表中?,r,shell,R,Shell,我知道在R中运行shell脚本时使用的是系统命令: my.table <- system(command,intern=TRUE) my.table如果结果“table”有空格分隔符,并且回车标记行,则应将结果传递给read.table的“text”参数: inp.tbl <- read.table(text = system(command,intern=TRUE) ) inp.tbl我希望使用pipe比使用intern的system在内存和时间上更高效 inp.tbl &l

我知道在R中运行shell脚本时使用的是系统命令:

my.table <- system(command,intern=TRUE)

my.table如果结果“table”有空格分隔符,并且回车标记行,则应将结果传递给read.table的“text”参数:

 inp.tbl <- read.table(text = system(command,intern=TRUE) )

inp.tbl我希望使用
pipe
比使用
intern的
system
在内存和时间上更高效

inp.tbl <- read.table(pipe(command) )

inp.tbl我想你得自己做一些文本解析。一些不请自来的建议:1)
->
作业在技术上是正确的,但必须避免。2) 请张贴可复制的问题(),因为你会得到更好的答案。在这种情况下,您肯定要发布一些示例输出。“->赋值在技术上是正确的,但要避免”什么?(对早期版本的R用户的一个警告是:
read.table
及其派生的'text'参数是一个相对较新的添加。)