问题
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