[R] zero-offset matrices (PR#132)

p.dalgaard@biostat.ku.dk p.dalgaard@biostat.ku.dk
Tue, 2 Mar 1999 16:59:52 +0100


Prof Brian Ripley <ripley@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@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._