I don't understand what is happening! I have a (large) object sim1, an matrix list with dim c(101,101) where each element is an 3*3 matrix. I am subsetting that with a matrix coo, of dim c(100,2), of unique indices, but the resulting object has length 99, not 100 as expected.
Code reproducing the problem follows: library(RandomFields) set.seed(123) sim0 <- GaussRF(x=seq(0, 100, by=1), y=seq(0, 100, by=1), grid=TRUE, model="spherical", param=c(0, 1, 0, 10), trend=NULL, n=9, gridtriple=FALSE) simmatrices <- function(arr) # arr must be an array of rank 3 { d <- dim(arr) n1 <- d[1]; n2 <- d[2] # we suppose d[3]==9 res <- vector(length=n1*n2, mode="list") dim(res) <- c(n1, n2) for (i in 1:n1) for (j in 1:n2) { x1 <- arr[i, j, 1:3];x2 <- arr[i, j, 4:6] x3 <- arr[i, j, 7:9] res[[i, j]] <- x1%o%x1 + x2%o%x2 + x3%o%x3 } res } sim1 <- simmatrices(sim0) set.seed(234) x <- sample(seq(0, 100, by=1), 101, replace=TRUE) y <- sample(seq(0, 100, by=1), 101, replace=TRUE) coo <- cbind(x=x, y=y) coo <- unique(coo) sim1.obs <- sim1[coo] dim(coo) length(sim1.obs) > sessionInfo() R version 2.11.1 (2010-05-31) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C [3] LC_TIME=en_US.utf8 LC_COLLATE=en_US.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_US.utf8 [7] LC_PAPER=en_US.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lattice_0.18-8 gstat_0.9-69 sp_0.9-66 [4] RandomFields_1.3.41 loaded via a namespace (and not attached): [1] fortunes_1.3-7 grid_2.11.1 tools_2.11.1 > Kjetil ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel