Skip to content
Prev 14150 / 63458 Next

Destructive str(...)?

On Fri, 29 Oct 2004, Simon Urbanek wrote:

            
Yes, and I think it is documented somewhere, but I can't lay my hands on 
it right now.
The issue is almost certainly that something has forgotten/decided not to
either set or respect SET_NAMED on the object, so when str does

	object <- unclass(object)

or some such, the original object gets changed.  Now the `something' has 
to be C code: possibly yours but probably something in R itself.

I think this is intentional.  External references do not get copied, and
the advice I recall is to wrap them in a list for use at R level (and
before setting a class on them).  In RODBC I took another tack, and attach
the reference as an attribute to a `documentation' object.

str() probably ought to be more cautious when it encounters at external 
reference or similar exotic object, since it will look at list elements 
and attributes.

Brian