[R] Error using outer

Alberto Monteiro albmont at centroin.com.br
Tue Oct 3 15:52:38 CEST 2006


Why is this an error?

  mat <- matrix(1:64, 8, 8)
  x <- y <- 1:8
  z <- outer(x, y, function(x, y) mat[x,y])

when this is not an error:

  mat <- matrix(1:64, 8, 8)
  x <- y <- 1:8
  z <- outer(x, y, function(x, y) paste("mat[", x, ",", y, "]", sep=""))

Alberto Monteiro



More information about the R-help mailing list