On 29 September 2010 09:47, Remko Duursma wrote: > > > How about: > > y[y[,2] %in% x.samp[,2],] > > gives you the subset of y where values in the second column are restricted > to your sample from x. > > You can then sample from this matrix, if you need to...
Just saw this reply tangled up in another topic (at least in my inbox). Yes, that gives all the rows of matrix y that contain a col 2 value in the matrix sampled from x but still leaves a bit of leg work to do and doesn't check that the sampling is actually possible. Michael ______________________________________________ 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.