[R-pkg-devel] Errors in my package

Joris Meys Jori@@Mey@ @ending from ugent@be
Fri May 25 11:03:16 CEST 2018


On Thu, May 24, 2018 at 10:11 PM, Steven Spiriti <puzzlesteven using gmail.com>
wrote:

>
> > x <- 0:30/30
> > truey <- x*sin(10*x)
> > set.seed(10556)
> > y <- truey + rnorm(31, 0, 0.2)
> > xy.freekt <- freelsgen(x, y, degree = 2, numknot = 2, 555)
> > coef(xy.freekt)
> Error: $ operator not defined for this S4 class
> Execution halted
>

The error and the code of the function tell me there is a problem with
dispatching. You treat xy.freekt as an S4 class and R thinks so too. The
coef generic is S3. The default method for this generic extracts
object$coefficients, and that can't work on an S4 class. This would explain
the error you see: instead of using the appropriate method, the dispatching
apparently uses the default S3 method.

Can you link us to a github repo or so where we can see the code? I suspect
either a problem with the NAMESPACE or with the class definitions. Are you
sure freelsgen returns the class you expect it to return?

Cheers
Joris

-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
<https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>

tel: +32 (0)9 264 61 79
-----------
Biowiskundedagen 2017-2018
http://www.biowiskundedagen.ugent.be/

-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list