Full_Name: Peter Sint
Version: 1.22
OS: MacOS 9.04
Submission from: (NULL) (193.170.84.51)
The not so serious problem is probably not specific to Macintosh although I
found it there:
The small example from R-intro works .> x <- array(1:20,dim=c(4,5))
> i <- array(c(1:3,3:1),dim=c(3,2))
> i
[,1] [,2]
[1,] 1 3
[2,] 2 2
[3,] 3 1> x[i]
[1] 9 6 3
x[i] has no attribute!> x
[,1] [,2] [,3] [,4] [,5]
[1,] 1 5 9 13 17
[2,] 2 6 10 14 18
[3,] 3 7 11 15 19
[4,] 4 8 12 16 20> x[i] <- 0
> x
[,1] [,2] [,3] [,4] [,5]
[1,] 1 5 0 13 17
[2,] 2 0 10 14 18
[3,] 0 7 11 15 19
[4,] 4 8 12 16 20>
> colnames(x)<-
c("c1","c2","c3","c4","c5")
> x[i]
[1] 9 6 3
BUT> rownames(x)<-
c("r1","r2","r3","r4")
> x[i]
NA NA r3
9 6 3 >
Rownames result in unsuccessful name formation (colnames do most likely not, but
this may depend on the order in the index array i). Better drop name making if
not o.k.
(Replacement [<- still works.
Index matrices do not work on data frames, not a bug but a missing feature with
work around)
Reproduce:
x <- array(1:20,dim=c(4,5))
i <- array(c(1:3,3:1),dim=c(3,2))
i
x[i]
x
x[i] <- 0
x
colnames(x)<-
c("c1","c2","c3","c4","c5")
x[i]
rownames(x)<- c("r1","r2","r3","r4")
x[i]
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._