Erron during R update from 3.4.4 to 4.2.2 : NextMethod('predict') : No method to invoke

53 Views Asked by At

I have a big R project that was developed in version 3.4.4 . I have been tasked to upgrade the project to R version 4.2.2

First thing I notice is when I load my package I.e. devtools::load_all(.) is I am getting below warning

Registered S3 method overwritten by 'quantmod':
method            from
as.zoo.data.frame zoo

Now coming to the error part

My code is using dyn library - predict method as below

As I understand , this predict.dyn will apply the predict method based on class of object, which is zoo in my case .

When I run this code in updated code (R 4.2 2) its throwing error

No method to invoke

So that's why I think because quantmod is overwriting methods of zoo package leading to this error as the code works fine ith old code (3.4.4)

Could anyone help me how to solve this issue .

predict.dyn method definition

function (object, newdata,...){

if (missing(newdata)) return(fitted(object))

class (object) <- setdiff(class (object), "dyn")

series <- attr (model.frame(object), "series")

.Class <- class (series [[1]])

NextMethod("predict")}

Here value of .Class is zoo and value of class(object) is lm

In old code(3.4.4) next method('predict') was invoking predict.zoo

I am not able to provide reproducible code , but let me know what do I need to provide to help solve this.

Please note ,, nothing has changed except for upgrades in package.

0

There are 0 best solutions below