Hi, 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 function,
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 ) system2(psql, args) And the return value of system2 function is 127. Regards, Xiaobo Gu ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.