将系统命令的输出存储到 r 中的变量中 [英] store output of system command into a variable in r

查看:23
本文介绍了将系统命令的输出存储到 r 中的变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 R 中执行以下命令:

I am executing the following command in R :

system("ls ")

我需要将上述命令的输出存储在某个 R 变量中.有没有办法做同样的事情??

I need to store the output of the above command in some R variable. Is there a way to do the same??

推荐答案

使用 intern=TRUE:

a <- system("ls ", intern = TRUE)

这篇关于将系统命令的输出存储到 r 中的变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆