SCM

SCM Repository

[matrix] Diff of /pkg/R/Matrix.R
ViewVC logotype

Diff of /pkg/R/Matrix.R

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

revision 1224, Mon Mar 13 13:05:33 2006 UTC revision 1225, Mon Mar 13 14:06:17 2006 UTC
# Line 229  Line 229 
229  setMethod("[", signature(x = "Matrix",  setMethod("[", signature(x = "Matrix",
230                           i = "missing", j = "missing", drop = "ANY"),                           i = "missing", j = "missing", drop = "ANY"),
231            function (x, i, j, drop) x)            function (x, i, j, drop) x)
232    
233  ## missing 'drop' --> 'drop = TRUE'  ## missing 'drop' --> 'drop = TRUE'
234  ##                     -----------  ##                     -----------
235  ## select rows  ## select rows
# Line 248  Line 249 
249            function(x,i,j, drop)            function(x,i,j, drop)
250            stop("invalid or not-yet-implemented 'Matrix' subsetting"))            stop("invalid or not-yet-implemented 'Matrix' subsetting"))
251    
252    ##  "logical *vector* indexing, such as  M [ M >= 10 ] :
253    setMethod("[", signature(x = "Matrix", i = "lMatrix", j = "missing",
254                             drop = "ANY"),
255              function (x, i, j, drop) {
256                  as(x, geClass(x))@x[as.vector(i)]
257                                            # -> error when lengths don't match
258              })
259    
260    setMethod("[", signature(x = "Matrix", i = "logical", j = "missing",
261                             drop = "ANY"),
262              function (x, i, j, drop) as(x, geClass(x))@x[i])
263    
264    
265  ## "FIXME:"  ## "FIXME:"
266  ## How can we get at   A[ ij ]  where ij is (i,j) 2-column matrix?  ## How can we get at   A[ ij ]  where ij is (i,j) 2-column matrix?
267  ##  and                A[ LL ]  where LL is a logical *vector*  ##  and                A[ LL ]  where LL is a logical *vector*

Legend:
Removed from v.1224  
changed lines
  Added in v.1225

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