Message-ID: <CH2PR20MB30456CD6F2ABB4807DE17BF1BE7B9@CH2PR20MB3045.namprd20.prod.outlook.com>
Date: 2021-04-01T15:01:09Z
From: Sean Trende
Subject: Identifying adjacent polygons within larger polygon groupings
Hello,
I am using sf for the project below, but am open to non-sf solutions.
Given an sf data.frame of polygons sorted into n contiguous groups (e.g., a column in the df identifies each polygon as a member of group (1, . . ., n), where within each group all polygons are neighbors), is there a simple way to identify all polygons in, say, Group 5 that are neighbors to polygons in, say, Group 8 (assuming groups 5 and 8 are neighbors)?
E.g., if I have an sf data.frame of U.S. counties with a column that identifies the state in which each county is located, is there a way to identify all counties on the border between, say, Kansas and Nebraska?
Thank you so much,
Sean