[R] S4 object slot of type 'call'

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon May 28 17:34:20 CEST 2007



Roberto Brunelli wrote:
> I'm using an S4 object with a slot of type 'call': I would like to be able to initialize 
> it with something like NULL or NA (indicating that there is no information in the slot)
> but the value should comply with the fact that it must be of type call.
>
> Is there any simple way to obtain this?


This looks fine:


 > setClass("testCall", representation = representation(call = "call"))
[1] "testCall"
 > test <- new("testCall")
 >
 > test
An object of class "testCall"
Slot "call":
`<undef>`()



Although, I found a bug while playing around:

cl <- call("round", 10.5)
cl[] <- NULL
cl
## CRASH using R-2.5.0 on Windows XP


Uwe Ligges



> Thanks for any hint,
> 
> 	Roberto
>



More information about the R-help mailing list