Re: [R] Question Regarding 'pipe'

From: Jan T. Kim <jtk_at_cmp.uea.ac.uk>
Date: Tue, 08 Apr 2008 10:45:10 +0100

On Mon, Apr 07, 2008 at 07:42:50PM -0500, born.to.b.wyld_at_gmail.com wrote:
> Can anyone point out why this is not working?
>
> y<-read.table(pipe(' awk '{ n = $1; sub( ".*" $1 " " ,"") ; while ( n-- )

                            ^

> print }' temp.txt '))
^

one problem is that your single-quoted R string contains single quotes which I've pointed to with "^" above. You probably intend these single quotes to be part of the awk command line, but R can\'t know that unless you escape them... ;-)

In the future, can you please describe explicitly how it "is not working", and also give a bit more context, such as a few lines of description of the content of temp.txt, and why you're trying to use awk (rather than R itself) to achieve whatever you're trying to achieve?

Best regards, Jan

-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: jtk_at_cmp.uea.ac.uk                               |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

______________________________________________
R-help_at_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.
Received on Tue 08 Apr 2008 - 09:47:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 12:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive