>>>>> "Jan" == Jan de Leeuw <[EMAIL PROTECTED]>
>>>>>     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

    Jan> I would like to use this for an R service, which allows
    Jan> you to select any string in any application and replace
    Jan> it by its R evaluation

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to