[R] paste / system mystery

ivo_welch-rstat8303@mailblocks.com ivo_welch-rstat8303 at mailblocks.com
Mon Aug 15 19:23:22 CEST 2005


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?

help appreciated.

/iaw


---
ivo welch




More information about the R-help mailing list