[R] Question about escapes character in args parameter of the system2 function.
guxiaobo1982 at gmail.com
Wed Dec 14 11:12:01 CET 2011
I am trying to use the system2 function to execute external
applications(actually it is psql) inside R 2.14.0 on X64 Windows, but
the psql command has escape character inside it's full command line,
can you help to figure out the correct parameters for the system2
The working command is :
psql -h 192.168.72.7 -U gpadmin -w -d miner_demo -c"\copy demo.store
to 'd:\store.csv' with csv header"
and my R code is:
psql <- "psql.exe"
gphost <- "192.168.72.7"
gpuser <- "gpadmin"
gpdb <- "miner_demo"
copycmd <- "-c \"\\copy demo.store to 'd:\\store.csv' with csv header\""
args <- c("-h", gphost, "-U", gpuser, "-w", "-d", gpdb, copycmd )
And the return value of system2 function is 127.
More information about the R-help