[Rd] can R_do_slot_assign change slot type

From: Vadim Ogranovich <vograno_at_evafunds.com>
Date: Tue 22 Mar 2005 - 06:22:39 GMT


Hi,  

It seems that R_do_slot_assign can change the type of an S4 class slot. For example I have a class  

setClass("ostream", representation(id = "integer", keepOpen = "logical"))

and inside a C-function I was able to assign a RAW vector to the id slot. Is this intentional? I remember reading somewhere that the slot type is guaranteed by R. Maybe this doesn't extend to C code?    

Now, in the above example I actually don't know the eventual type of the 'id' slot, it will be set up in some C code that intializes the class instance. What is the right way to define the representation in such a case?  

Thanks,
Vadim

        [[alternative HTML version deleted]]



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Mar 22 17:24:29 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:02 GMT