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

如何存储从R studio到Mac OS X的系统调用响应,r,macos,system,R,Macos,System,我不知道该怎么问这个问题。我想在R studio Mac中存储系统命令的响应 例如,此命令: system("pwd") 返回以下内容: /Volumes/chart/chart 我希望将返回值存储在如下变量中: result <- system("pwd") result使用intern参数 result <- system('pwd', intern = T) result #> [1] "/Volumes/chart/chart" result[1]“/Volum

我不知道该怎么问这个问题。我想在R studio Mac中存储系统命令的响应

例如,此命令:

system("pwd")
返回以下内容:

/Volumes/chart/chart
我希望将返回值存储在如下变量中:

result <- system("pwd")

result使用
intern
参数

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