Dear All,

Can somebody explain me how to correctly set a new class-specific method
for generic functions (e.g. for "plot", "summary" and "print"). I simply
programmed these functions with the class names and it works perfectly.
E.g.:

x<-2
y<-3
class(x)<-"newclass"
class(y)<-"newclass"
print.newclass<-function(x){ cat(x*10) }
print(x)
print(y)

However, I need the new methods for a new package, and the "R CMD check"
gives me warnings that my approach is not correct. I have to define
"methods" and do not use full names as "print.newclass".
I read the "Writing R Extensions" and it is not explained there (at least
to such level that I could get it) and I didn't get anything understandable
by googling.

Maybe someone can help me?

Many thanks in advance!
Mikhail

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to