[R] Getting 2 kinds of quotes inside a pasted string

Wiener, Matthew matthew_wiener at merck.com
Fri Sep 12 04:12:56 CEST 2003


Hi, all.

I would like to use "pipe" to run a file through an awk program before
scanning (to reduce the amount of data I'll be taking in).  I would like to
construct the awk program in R, and also to be able to set the awk variable
FS, to accommodate different field separators in different files.

My problem is that I keep getting the quotes escaped in the string that
comes out, and that sets the field separator to something different.

What I'd like to end up with is something like: 
	awk 'BEGIN{FS=";"}'  
If I can get this, I can put the rest of the awk program together.  What I
actually keep getting is 
awk 'BEGIN{FS=\";\"}'.  
That is, the quote characters are escaped.

I can print this with quote = FALSE, and get the string I'm looking for.
But when I paste that into the larger awk program, the quotes are
nonetheless escaped (presumably because the print, quote = FALSE affects
only display and not the internal structure).

I've also tried sprintf, but run into the same problem.  I'd very much
appreciate it if someone could show me how to create the string I'm looking
for, or tell me a better way to go about filtering the file in the first
place.  I'd prefer not to scan in everything and do the subsetting in R; the
files I'm using are very large, and the whole point is not to have to load
the whole file into memory.

Thanks very much,

Matthew Wiener
RY84-202
Applied Computer Science & Mathematics Dept.
Merck Research Labs
126 E. Lincoln Ave.
Rahway, NJ 07065
732-594-5303 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list