[R] A clean way to initialize class slot of type "numeric" vector

adschai at optonline.net adschai at optonline.net
Mon Aug 13 07:01:32 CEST 2007


Hi, 

I have a class definition like this:

setClass("foo", representation(members="numeric"),
   prototype(members=c()))

I intend my class to have members, a slot whose value should be a vector of integer. When I initialize this class, I don't have any member yet. So my member is blank. But if I run the above definition into R, it will complain that my slot members is assigned to NULL which does not extend class "numeric". So how can I fix this? Is there any clean way to do this? This is quite a common situation but I can't seem to find a way out. Any help would be really appreciated. Thank you.

- adschai



More information about the R-help mailing list