tags:

views:

40

answers:

1

Hi i am using R on windows XP i have cygwin on my shell path what i want to do is send a command to gawk via R shell command this way: shell("gawk "{print $1}"", m[1],"_", h[i]."_79.7.dat""} i get this error Error: unexpected '{' in "shell("gawk "{" how can i fix this problem? Thank you

+1  A: 

escape your quotes. Example only (not sure what R shell syntax is)

shell("gawk \"{print $1}\"", m[1],"_", h[i]."_79.7.dat"")

experiment with escaping the quotes to get the correct result.

The other way is to build your gawk command string first , then pass to shell()

ghostdog74
Shouldn't the final `}` be a `)`?
nullglob
thank you!! another thing i didn't do is add paste()--> shell(paste(("gawk \"{print $1}\"", m[1],"_", h[i]."_79.7.dat""))
eliavs