Not sure how to best ask this. I want to store the response of a system command in R studio Mac.
For example, this command:
system("pwd")
Returns this:
/Volumes/chart/chart
I would like to store the return in a variable like this:
result <- system("pwd")
but this does not work.
Use the intern
parameter.
result <- system('pwd', intern = T)
result
#> [1] "/Volumes/chart/chart"