I *think* that split(x,f) in S/S-PLUS (SunOS 4, S-PLUS 3.2) by default replicates f as many times as necessary to cover the length of x. In R it apparently doesn't. I have the following function: matsplit <- function (x, crit) { lapply(split(x, crit), matrix, ncol = ncol(x)) # x is a matrix, crit is a vector with length dim(x)[1] ... # makes a list of matrices split by row } The following: y _ cbind(matrix(1:10,ncol=2,byrow=T),rep(1:2,c(2,3))) matsplit(y[,1:2],y[,3]) gives $"1": [,1] [,2] [1,] 1 2 [2,] 3 4 $"2": [,1] [,2] [1,] 5 6 [2,] 7 8 [3,] 9 10 in S-PLUS; in R it gives Error in split(x, as.factor(f)) : argument lengths differ I can find a workaround. Is this a bug, a feature, or just a difference? Benjamin Bolker Dep't of Ecology and Evolutionary Biology, ben@eno.princeton.edu Princeton University tel: (609) 258-6886, fax: (609) 258-1334 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-