



Dear all,

I would appreciate a lot, if someone could explain to me in a simple
way, why the assignment class<- is not always working and one has to
take as() like in the example below.

> (v <- matrix(1:9, 3))
     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9
> class(v)
[1] "matrix"

> class(v) <- "integer"
> class(v)
[1] "matrix"
> v
     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9

> (vi <- as(v, "integer"))
[1] 1 2 3 4 5 6 7 8 9
> class(vi)
[1] "integer"


With many thanks,

Stefan
	[[alternative HTML version deleted]]


