tags:

views:

71

answers:

2

I have the following two lines of code that both run fine in both R and Python (via Rpy):

[R] rcut = cut(vector, brks)
[Python] rcut = r.cut(vector, brks)

However, if I want to add the argument of include.lowest=TRUE, it runs as expected in R:

[R] rcut = cut(vector, brks, include.lowest=TRUE)

But it doesn't work in Rpy:

[Python] rcut = r.cut(vector, brks, include_lowest="TRUE")

which gives the following error:

rpy.RPy_RException: Error in ok && include.lowest : invalid 'y' type in 'x && y'

Do you know what might cause that and what should I do to make it work? Thx!

+5  A: 

I don't know rpy, but could it be due to using "TRUE" (a character) instead of TRUE (a logical)?

EDIT: The rpy documentation seems to indicate using r.TRUE:

http://rpy.sourceforge.net/rpy/doc/rpy_html/R-boolean-objects.html#R-boolean-objects

Joshua Ulrich
Yup - worked beautifully. Thx!
Zhang18
+1  A: 

I know nothing about Rpy, but I would guess it needs to be include_lowest=True (No quotes, True is a boolean value in python.)

Joe Kington