[R] thanks

Jan T. Kim jtk at cmp.uea.ac.uk
Wed Jan 12 15:39:44 CET 2005


On Tue, Jan 11, 2005 at 04:24:11PM +0100, Lefebure Tristan wrote:

> example from a shell:
> 
> echo -e "pdf(file=\"test.pdf\")\nplot(1:10,11:20)\ndev.off(dev.cur())\n">cmd.R
> R -s <cmd.R
> 
> (write a file of command for R, and than feed R with it)

This may be on the verge of becoming offtopic, but let me remark
that the technique proposed here should be used for illustrative
purposes only. For real life, use pipes:

    echo 'print(mean(rnorm(10)));' | R --vanilla

This is equivalent to

    echo ''print(mean(rnorm(10)));' > cmd.R
    R --vanilla < cmd.R

*as long as only one shell is executing this sequence at any given time*.

The reason I mention this here is that I've seen it happen a few times
that this "temporary command file" approach has made it from examples
into shell scripts of which then, later on, multiple instances were
run at a time, resulting in very rare, very irreproducible, and most
inexplicable erroneous results.

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




More information about the R-help mailing list