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 907, Thu Sep 8 15:28:48 2005 UTC revision 925, Mon Sep 19 19:01:31 2005 UTC
# Line 60  Line 60 
60  mC[,1]  mC[,1]
61  mC[1:2,]  mC[1:2,]
62  mC[7, drop = FALSE]  mC[7, drop = FALSE]
63    stopifnot(identical(mC[7,  drop = FALSE],
64                        mC[7,, drop = FALSE]))
65  mT[,c(2,4)]  mT[,c(2,4)]
66  mT[1,]  mT[1,]
67  mT[4, drop = FALSE]  mT[4, drop = FALSE]
# Line 68  Line 69 
69            identical3(mm[3,], mC[3,], mT[3,]),            identical3(mm[3,], mC[3,], mT[3,]),
70            identical3(mT[2,3], mC[2,3], 0),            identical3(mT[2,3], mC[2,3], 0),
71            identical(mT[], mT),            identical(mT[], mT),
72            ## TODO: identical4() with  m[c(3,7), 2:4]            ## TODO: identical4() with  m[c(3,7), 2:4] - fail because of 'dimnames'
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    ## --- negative indices ----------
77    mc <- mC[1:5, 1:7]
78    mt <- mT[1:5, 1:7]
79    ## sub matrix
80    stopifnot(identical(mc[-(3:5), 0:2], mC[1:2, 0:2]),
81              identical(mt[-(3:5), 0:2], mT[1:2, 0:2]))
82    ## sub vector
83    stopifnot(identical4(mc[-(1:4), ], mC[5, 1:7],
84                         mt[-(1:4), ], mT[5, 1:7]))
85    stopifnot(identical4(mc[-(1:4), -(2:4)], mC[5, c(1,5:7)],
86                         mt[-(1:4), -(2:4)], mT[5, c(1,5:7)]))
87    
88    ## mixing of negative and positive must give error
89    assertError(mT[-1:1,])
90    
91  ## At least these now give a nicely understandable error:  ## At least these now give a nicely understandable error:
92  try(mT[1, 4] <- -99)  try(mT[1, 4] <- -99)
93  try(mT[2:3, ] <- 0)  try(mT[2:3, ] <- 0)

Legend:
Removed from v.907  
changed lines
  Added in v.925

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