[R] zero-offset matrices

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Mar 2 16:59:48 CET 1999


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> "[<-.zoffset"  <- function(x, i, j, value)
> {
>   if(!missing(i) && is.numeric(i)) i <- i+1
>   if(!missing(j) && is.numeric(j)) j <- j+1
>   NextMethod("[<-")
> }
> works in S but not in R. (Which I think is a bug.) I next tried

Yup, there's a bug in there somewhere, MatrixAssign ends up getting
called with the symbol "value" where the actual replacement value
should have been.

Of course, the whole point becomes a bit moot when one considers
*removing* rows and columns from a matrix...

To tickle the bug:

"[<-.zoffset"  <- function(x, i, j, value)
{
  if(!missing(i) && is.numeric(i)) i <- i+1
  if(!missing(j) && is.numeric(j)) j <- j+1
  NextMethod("[<-")
}
m<-matrix(1:4,2,2)
m[0,]<-4:5

Probably, set a breakpoint in do_subassigne and step through it.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list