On Sat, Jul 26, 2008 at 3:38 PM, laurent oget <[EMAIL PROTECTED]> wrote:
> Here you are:
>
from rpy import *
a=[1,2,3,4]
b=r['<'](a,3)
b
> [True, True, False, False]
You can of course do this in pure python, which might be easier
depending on why you want to do this.
a = [1,2,
Here you are:
>>> from rpy import *
>>> a=[1,2,3,4]
>>> b=r['<'](a,3)
>>> b
[True, True, False, False]
>>>
2008/7/25 Zhang, Minhua <[EMAIL PROTECTED]>:
> In R, I could do:
>
> > a <- c(1,2,3,4)
> > smalla <- a<3
> > smalla
> [1] TRUE TRUE FALSE FALSE
>
> But how do I create such a variable '
In R, I could do:
> a <- c(1,2,3,4)
> smalla <- a<3
> smalla
[1] TRUE TRUE FALSE FALSE
But how do I create such a variable 'smalla' in python via RPy?
Here is what I tried, none works:
>>> from rpy import *
>>> a = (1,2,3,4)
>>> smalla = r(a<3)
>>> smalla
False
>>> smalla = r("a<3")
Traceback