I am using rpy2 to call R packages in Python and I am facing technical problems. Some functions in R packages have a dot "." in their names, so it is hard for Python to identify these functions. For example, there is a function called "Granger.conditional()" in the R package called "grangers". When I use rpy2 to call the function like this:
grangers = rpackages.importr('grangers')
res = grangers.Granger.conditional(trnsetmdl_i.iloc[:, i], trnsetmdl_i.iloc[:, j], trnsetmdl_i.iloc[:, k])
I am getting the following error message:
Traceback (most recent call last):
File "D:/CMAPSSRUL/TimeSeriesModelling/GrangerCausality/ConditionalGC.py", line 53, in <module>
res = grangers.Granger.conditional(trnsetmdl_i.iloc[:, i], trnsetmdl_i.iloc[:, j], trnsetmdl_i.iloc[:, k])
AttributeError: module 'grangers' has no attribute 'Granger'
Anyone has solutions to this problem?