Rpy2: calling to function conaining dots

微笑、不失礼 提交于 2020-05-28 09:48:55

问题


I'm tring to run a R function in Pyton via Jupyter Notebook. the problem is, that my function name (from mice lib) - containing dot. the name of the function is md.pattern, and this is the code that I'm tring to run:

from rpy2.robjects.packages import importr
mice = importr('mice')
mice.md.pattern(train)

and this is the error that I get:

AttributeError: module 'mice' has no attribute 'md'

I also tried to run:

from rpy2.robjects.packages import importr
mice = importr('mice')

pattern = robjects.r("md.pattern")
mice.pattern(train)

and get the same error.


回答1:


Beside the suggested answer in the comments, the doc suggests that the following should work:

mice.md_pattern(train)

https://rpy2.github.io/doc/v3.3.x/html/introduction.html#importing-packages



来源:https://stackoverflow.com/questions/61652953/rpy2-calling-to-function-conaining-dots

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!