Skip to contents

Manually enforce contiguity between two areas

Usage

st_manual_join_nb(nb, x, y)

Arguments

nb

a neighbourhood `"list"` or `"matrix"`, or an `sf` dataframe with a neighbourhood column called `"nb"`.

x

name or number of first area.

y

name or number of second area.

Value

An amended neighbourhood `"list"`, `"matrix"`, or `sf` dataframe with a neighbourhood column called `"nb"`.

Examples

st_bridges(uk_election,"constituency_name") |>
st_manual_join_nb("Gower","St Ives")
#> Simple feature collection with 632 features and 9 fields
#> Geometry type: GEOMETRY
#> Dimension:     XY
#> Bounding box:  xmin: 5513.182 ymin: 7057.949 xmax: 655655.4 ymax: 1218620
#> Projected CRS: OSGB36 / British National Grid
#> First 10 features:
#>    degree_educated health_not_good      white  con_swing population
#> 1      -1.21794372       2.4694480  0.6393329  8.5917223      66133
#> 2       0.04609836       0.5666903  0.6561204  2.2040312      56415
#> 3       0.26593462      -0.8699365  0.1441816  7.1285493      99654
#> 4       1.62837520      -1.7731408  0.3038995  2.9732599      93197
#> 5      -1.35386780       0.8155333  0.6963927 -0.2362672      85845
#> 6      -0.21109416      -1.3619136 -0.1675498  5.6993250     103922
#> 7      -0.74760203       0.8047040  0.3409127  7.4304029      76974
#> 8       1.63438559      -1.1613230  0.1605045 -0.4813182      96591
#> 9      -0.65926781      -0.1982048  0.6815335  5.6002269      82505
#> 10     -0.96445730       0.9975218  0.6930268  9.4698002      87883
#>           region             county        constituency_name
#> 1          Wales     West Glamorgan                 Aberavon
#> 2          Wales              Clwyd                Aberconwy
#> 3       Scotland           Scotland           Aberdeen North
#> 4       Scotland           Scotland           Aberdeen South
#> 5       Scotland           Scotland       Airdrie and Shotts
#> 6     South East          Hampshire                Aldershot
#> 7  West Midlands      West Midlands      Aldridge-Brownhills
#> 8     North West Greater Manchester Altrincham and Sale West
#> 9          Wales              Clwyd         Alyn and Deeside
#> 10 East Midlands         Derbyshire             Amber Valley
#>                                       nb                       geometry
#> 1            80, 157, 371, 419, 451, 547 POLYGON ((290786.3 202886.7...
#> 2                           12, 141, 181 POLYGON ((283209.3 381440.5...
#> 3                            4, 239, 595 MULTIPOLYGON (((395379.7 80...
#> 4                                 3, 595 POLYGON ((396214 805849.7, ...
#> 5           142, 156, 309, 327, 332, 369 POLYGON ((290854.4 662154.9...
#> 6                      70, 395, 517, 544 POLYGON ((485408.1 159918.6...
#> 7  49, 106, 325, 509, 546, 549, 577, 578 POLYGON ((406519.5 305056.1...
#> 8                540, 550, 583, 584, 628 POLYGON ((379104.1 393145.7...
#> 9           136, 140, 141, 162, 205, 624 POLYGON ((331643.4 372873.5...
#> 10             15, 61, 93, 165, 212, 352 POLYGON ((444868.5 353960.2...