Re: [R] paste / system mystery

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Tue 16 Aug 2005 - 03:43:44 EST

On Mon, 15 Aug 2005 ivo_welch-rstat8303@mailblocks.com wrote:

>
> Dear R wizards:
>
> under R-2.1.0:
>
> eargs <- 3:5;
> line <- paste(c("echo A B", eargs));
> cat("executing from R: '", line, "'\n");
> system(line);
>
> Oddly, only "A" and "B" are echoed, not the eargs. I had hoped that
> line would be one string at this point, and for printing this seems to
> be true. However, unlist(line) still gives me the 4 components. It
> almost seems like the objects were not really pasted, but kept separate
> [perhaps to conserve memory]---which works internally, but not
> externally.
>
> Is this my poor understanding of R, an R "feature," or an R bug?
>

It's your understanding. Look at the `collapse' argument to paste().

         -thomas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 16 03:53:20 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:21:14 EST