All, I am attempting to select all of the contiguous elements of a matrix that meet some criterion. I.e., values that would be contained within an irregular area defined by a "contour" applied around point of interest. So, if I have a matrix x as follows:
> x <- matrix(rnorm(25), nrow=5, ncol=5, dimnames=list(c("A","B","C","D","E"), c("v","w","x","y","z")) > x v w x y z A 0.5184795 1.9641285 0.8632044 1.5010397 0.8468490 B -1.2402866 0.5211307 -0.1474351 1.3264893 0.1087390 C 0.5910275 -1.1708906 0.9440755 1.0970971 -0.2784806 D 0.6377495 1.1594035 -0.4217621 1.4021680 -0.6487677 E -1.4590833 0.2065765 0.1623669 1.3598283 0.3742821 > how can I select all values in the "pond" of contiguous matrix entries that have values, say <0.6, if my entry of interest is x["A","v"]. In that case, I would like to select the following starred entries: v w x y z A 0.5184795* 1.9641285 0.8632044 1.5010397 0.8468490 B -1.2402866* 0.5211307* -0.1474351* 1.3264893 0.1087390 C 0.5910275* -1.1708906* 0.9440755 1.0970971 -0.2784806 D 0.6377495 1.1594035 -0.4217621* 1.4021680 -0.6487677 E -1.4590833 0.2065765* 0.1623669* 1.3598283 0.3742821 But I would _not_ like to select any of the values in x[,"z"], because, even though they may be <0.6, they are not contiguous with the pond that x["A","v"] is in. Is there an easy way to do this for many points of interest in a large matrix? Thanks, -bryan ------ Bryan McCloskey, Ph.D. U.S. Geological Survey St. Petersburg Coastal & Marine Science Center St. Petersburg ------ ______________________________________________ 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.