Thank you Dimitris, that solves it exactly! I continue to be amazed at how a single line of code can be so powerful in R, containing so much information. Hard as hell to interpret though (for me). Jim
> one approach is the following: > > B <- cbind(c(1:6, NA), c(1:3, NA,NA,NA, 4), c(1:3, NA,NA, 4,5)) > matrix(B[order(col(B), B)], nrow(B), ncol(B)) > > > I hope it helps. > > Best, > Dimitris Jim Bouldin, PhD Research Ecologist Department of Plant Sciences, UC Davis Davis CA, 95616 530-554-1740 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.