LHA
LHA

Reputation: 51

Rpy2: calling to function conaining dots

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.

Upvotes: 0

Views: 293

Answers (1)

lgautier
lgautier

Reputation: 11555

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

Upvotes: 5

Related Questions