Skip to content
Prev 2777 / 12125 Next

[R-pkg-devel] Errors in R package - Updated

On 25/05/2018 3:25 PM, Steven Spiriti wrote:
The problem is that you are mixing up S3 and S4 stuff.  You have an S4 
class "freekt", but you are defining functions like coef.freekt and 
expecting them to act as methods for that class.  That's not how to 
define methods in S4.  You use the methods::setMethod() function to do 
that.  Using the naming convention generic.class() is the way to do it 
in S3.

Since your S4 class has no "coef" methods, you'll get the old S3 generic 
handling your coef(xy.freekt) call, and it doesn't know what to do with 
it.  It will pass the object to stats:::coef.default, which tries to 
extract the coefficients using object$coefficients, and that fails when 
object is xy.freekt.

Duncan Murdoch