[R-pkg-devel] how to fix checking S3 generic/method consistency ... WARNING

Iñaki Ucar iuc@r @ending from fedor@project@org
Thu Aug 30 10:21:05 CEST 2018


El jue., 30 ago. 2018 a las 9:02, Ulavappa Angadi
(<angadiub using gmail.com>) escribió:
>
> Dear sir
>
> How to fix the below problem and details as below kindly help
>
>
> * checking S3 generic/method consistency ... WARNING
> mbferns:
>   function(x, ...)
> mbferns.default:
>   function(x, y, nf, fsize, bnum)
>
> predict:
>   function(object, ...)
> predict.mbferns:
>   function(model1, x)

There is a problem in the method signature, as highlighted above.

> See section 'Generic functions and methods' in the 'Writing R
> Extensions' manual.

And this is the relevant section of the manual, where we can read the following:

- A method must have all the arguments of the generic, including … if
the generic does.

So the dots ("...") are missing in mbferns.default and
predict.mbferns, and also "model1" should be called "object", instead,
in predict.mbferns.

Iñaki

>
> NAMESPACE as below
> xport(mbferns)
>
> S3method(predict,mbferns)
> S3method(mbferns,default)
>
> useDynLib(mbFerns,mbrfern,mbrfern_predict)
>
> import(plyr)
> import(mlbench)
>
> Functions are as below in Mulit_Branch_Ferns.R
> mbferns<-function(x,...)
>  { UseMethod("mbferns")}
>
> mbferns.default <- function(x, y, nf=2, fsize=4, bnum=4) {
> xx <- .C("mbrfern", as.double(xm), as.integer(y), as.integer(nc),
> as.integer(nr), as.integer(c),  as.integer(nf), as.integer(fsize),
> as.integer(bnum), xmin1=double(nc), xmax1=double(nc),
> flist1=integer(nf*fsize), pc=double(c), w=integer(ws))
>   model<-list(nc=xx[[3]], c=xx[[5]], nf=xx[[6]], fsize=xx[[7]],
> bnum=xx[[8]], min=xx$xmin1, max=xx$xmax1, flist=xx$flist1, w=xx$w,
> ylist=ylist, pc=xx$pc)
>
>   class(model)<-"mbferns"
>
>    return(model)
> }
>
> predict.mbferns <- function(model1, x) {
>
> w1dens <- .C("mbrfern_predict", as.double(xm),  as.integer(model1$nc),
> as.integer(nr), as.integer(model1$c),  as.integer(model1$nf),
> as.integer(model1$fsize), as.integer(model1$bnum), as.double(model1$min),
> as.double(model1$max), as.integer(model1$flist), as.integer(model1$w),
> as.double(model1$pc), ye=integer(nr), prob=double(nr*model1$c) )
>
> }
> With regards
>
> Angadi U B
> Sr. Scientist
> CABin, IASRI, Pusa, New Delhi
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Iñaki Ucar



More information about the R-package-devel mailing list