SCM

SCM Repository

[matrix] Diff of /pkg/tests/indexing.R
ViewVC logotype

Diff of /pkg/tests/indexing.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 873, Sat Aug 27 21:26:23 2005 UTC revision 886, Wed Aug 31 17:49:47 2005 UTC
# Line 27  Line 27 
27            identical(m[2,], m[(1:nrow(m)) == 2, ]),            identical(m[2,], m[(1:nrow(m)) == 2, ]),
28            identical(m[,3:4], m[, (1:4) >= 3]))            identical(m[,3:4], m[, (1:4) >= 3]))
29    
30  ## dimnames index (TODO)  ## dimnames indexing:
31    mn <- m
32    dimnames(mn) <- list(paste("r",letters[1:nrow(mn)],sep=""),
33                         LETTERS[1:ncol(mn)])
34    mn["rd", "D"]
35    stopifnot(identical(mn["rc", "D"], mn[3,4]),
36              identical(mn[, "A"], mn[,1]),
37              identical(mn[c("re", "rb"), "B"], mn[c(5,2), 2])
38              )
39    
40    mo <- m
41    m[2,3] <- 100
42    m[1:2, 4] <- 200
43    m[, 1] <- -1
44    m[1:3,]
45    
46  ## TODO: more --- particularly once we have "m > 10" working!  ## TODO: more --- particularly once we have "m > 10" working!
47    
# Line 59  Line 73 
73            identical3(as(mC[c(3,7), 2:4],"matrix"), mm[c(3,7), 2:4],            identical3(as(mC[c(3,7), 2:4],"matrix"), mm[c(3,7), 2:4],
74                       as(mT[c(3,7), 2:4],"matrix")))                       as(mT[c(3,7), 2:4],"matrix")))
75    
76    ## At least these now give a nicely understandable error:
77    try(mT[1, 4] <- -99)
78    try(mT[2:3, ] <- 0)

Legend:
Removed from v.873  
changed lines
  Added in v.886

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge