如何将 R studio 的系统调用响应存储到 Mac OS X

how to store the response of a system call from R studio to Mac OS X

不确定如何最好地提出这个问题。我想在 R studio Mac 中存储系统命令的响应。

例如,这个命令:

system("pwd")

Returns 这个:

/Volumes/chart/chart

我想将 return 存储在这样的变量中:

result <- system("pwd")

但这不起作用。

使用intern参数。

result <- system('pwd', intern = T)
result
#> [1] "/Volumes/chart/chart"