[R] would be nice ...
Dirk Eddelbuettel
edd at debian.org
Tue Feb 24 13:49:10 CET 2004
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
More information about the R-help
mailing list