我有以下两行代码,在R和Python(通过RPY)中都可以正常运行:

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

但是,如果我想添加 include.lowest=TRUE, ,它按照R中的预期运行:

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

但是它在rpy中不起作用:

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

给出以下错误:

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

您知道可能导致这是什么,我该怎么做才能使它起作用?谢谢!

有帮助吗?

解决方案

我不知道 rpy, ,但这可能是由于使用 "TRUE" (角色)而不是 TRUE (逻辑)?

编辑: rpy 文档似乎表明使用 r.TRUE:

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

其他提示

我对rpy一无所知,但我想它必须是 include_lowest=True (没有报价, True 是Python的布尔值。)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top