[R] unclass

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Aug 16 17:00:12 CEST 2003


kjetil brinchmann halvorsen wrote:
> Have I been sleeping in class?
> 
> rw1071 from CRAN, windows XP
> 
> incidencia is made by a call to tapply
> 
> 
>>class(incidencia)
> 
> [1] "array"
> 
>>incidencia <- unclass(incidencia)
>>class(incidencia)
> 
> [1] "array"
> 
> 
> Kjetil Halvorsen
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

See ?class:

'If the object does not have a class attribute, it has an implicit 
class, "matrix", "array" or the result of mode(x).'

and ?unclass:

'unclass returns (a copy of) its argument with its class attribute removed.'


Since the return of value "array" had to be introduced for S4 
compatibility (all objects must have classes according to the green book 
- "array" is an implicit class), unclass() cannot remove that 
non-existant attribute.

BTW: oldClass(incidencia) still returns NULL ..., doesn't it?

Uwe Ligges




More information about the R-help mailing list