R function to calculate nearest neighbor distance given [inconsistent] constraint?
<p>I have data consisting of tree growth measurements (diameter and height) for trees at known X &amp; Y coordinates. I'd like to determine the distance to each tree's nearest neighbor <em>of equal or greater size</em>. </p>

<p>I've seen other SE questions asking about nearest neighbor calculations (e.g., see <a href="https://stackoverflow.com/questions/21977720/r-finding-closest-neighboring-point-and-number-of-neighbors-within-a-given-rad">here</a>, <a href="https://stackoverflow.com/questions/23449726/find-k-nearest-neighbors-starting-from-a-distance-matrix">here</a>, <a href="https://gis.stackexchange.com/questions/127244/is-there-an-r-equivalent-of-near-in-esri-arcgis">here</a>, <a href="https://gis.stackexchange.com/questions/19355/how-to-get-the-second-nearest-neighbor-between-two-point-patterns-in-r">here</a>, etc.), but none specify constraints on the nearest neighbor to be searched.</p>

<p><strong>Is there a function</strong> (or other work around) <strong>that would allow me to determine the distance of a point's nearest neighbor <em>given that nearest point meets some criteria</em></strong> (e.g., must be equal to or greater in size than the point of interest)<strong>?</strong></p>

<p>[An even more complex set of constraints would be even more helpful...]</p>

<ul>
<li>For my example: specifying that a tree must <em>also</em> be in the same plot as the tree of interest or is the same species as the tree of interest</li>
</ul>