Message-ID: <20040224124910.GA10007@sonny.eddelbuettel.com>
Date: 2004-02-24T12:49:10Z
From: Dirk Eddelbuettel
Subject: would be nice ...
In-Reply-To: <16443.5204.413726.233082@gargle.gargle.HOWL>
On Tue, Feb 24, 2004 at 10:07:32AM +0100, Martin Maechler wrote:
> >>>>> "Jan" == Jan de Leeuw <deleeuw at stat.ucla.edu>
> >>>>> on Tue, 24 Feb 2004 00:52:51 -0800 writes:
>
> Jan> if R had something like
> >> python -c "print(sum([1,2,3]));print(3*2)"
> Jan> 6 6
>
> Jan> but I guess the only way to do this is by writing the
> Jan> string to a tmp file and then doing something like "R
> Jan> CMD BATCH --quiet" on the tmp file
>
> Well, a bit better (with a shell prompt "%") is
>
> % echo "print(sum(c(1,2,3)));print(3*2)" | R --quiet --vanilla
>
> > print(sum(c(1,2,3)));print(3*2)
> [1] 6
> [1] 6
> >
>
> or (slightly nicer)
>
> % echo "sum(c(1,2,3)); 3*2" | R --quiet --vanilla
> > sum(c(1,2,3)); 3*2
> [1] 6
> [1] 6
> >
>
> but it still echoes the input by default
Not with --slave:
edd at chibud:~> echo "sum(c(1,2,3)); 3*2" | R --slave
[1] 6
[1] 6
I would be pretty trivial to filter the "^[1] " out.
Dirk
--
The relationship between the computed price and reality is as yet unknown.
-- From the pac(8) manual page