RRuntimeError: Error in UseMethod(“predict”) :(when i try to call a function(which reads a rpart model and tries to predict)in R from python)

Refresh

February 2019

Views

6 time

0

I have been trying to call a function in R from Python. When calling I'm getting an error saying that

there's no applicable method 'predict' for the object 'rpart'

I have tried importing rpy2 package and tried to call it but still I'm getting the same error

def function(arg1,arg2,arg3,arg4,
                        arg5,arg6):  
    r=ro.r
    r.source(path)
    final_dataframe =r.getValues(arg1,arg2,arg3,arg4,
                        arg5,arg6)
return final_dataframe 

getValues is a function in R that will be returning the predicted values. I'm expecting the predicted values but I'm getting the actual value as the mentioned error before

0 answers