[R] single quotes and double quotes in a system() command. What to do?

Matthew Keller mckellercran at gmail.com
Mon Mar 29 23:14:05 CEST 2010


Hi all,

I would like to run the following from within R:

awk '{$3=$4="";gsub("  ","");print}' myfile > outfile

However, this obviously won't work:
system("awk '{$3=$4="";gsub("  ","");print}' myfile > outfile")

and this won't either:
system("awk '{$3=$4='';gsub('  ','');print}' myfile > outfile")


Can anyone help me out? I'm sure there's an obvious solution. Thanks,

Matt


-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com



More information about the R-help mailing list