下面是一個例子:如何捕獲系統2()輸出中的R
RR<-"/usr/bin/R"
x<-system2(RR, "--version")
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
> x
[1] 0
正如你可以在這裏看到的x is 0
。我的問題是如何將'system2(RR,「--version」)'輸出分配給x
。
大,對你的幫助謝謝! –
我做的差不多相同[這裏](https://stackoverflow.com/questions/45426902/system2-to-call-python2-and-python3-inside-r)但我沒有得到預期的輸出,想法? – hhh