[R] extending data.frame with S4 class

Tim Bergsma timb at metrumrg.com
Thu Nov 30 14:27:21 CET 2006


Hi.

When I extend "numeric" with S4 and create an instance, I get something 
that looks and acts like a numeric.  When I extend "data.frame" and 
create an instance, I get a NULL 'core'.  Why is this, and can it be 
fixed?  setOldClass(), prototype=, and initialize() don't seem to help.

Thanks,

Tim
----
setClass("numClass",representation("numeric",num="numeric"))
nn <- new("numClass",2,num=1)
nn
nn+1

setClass("dfClass",representation("data.frame",num="numeric"))
df <- new("dfClass",as.data.frame(BOD),num=1)
df



More information about the R-help mailing list