Hi, Is there a way to extract a subset of non-contiguous elements of a matrix elegantly and with 1 or very few scripts?
Suppose I have a matrix of positive and negative numbers (m) and I want to retrieve only the positive number. This I can do which(m>0, arr.ind=T) which gives the indices of positive elements like (37,1), (80,1), ..., (54,2) etc. How can I extract positive numbers without looping on the indexes provided by which to make a new matrix? thanks, Carol [[alternative HTML version deleted]] ______________________________________________ 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.