View source: R/best_match_new.R
best_match_new | R Documentation |
This function takes the raw output of the overlap_dyad_creatr function (also part of the arealOverlapr pkg), and calculates slices the data to single unique values for the shp1 file. Observations are cut to the unique shp1 values for where the overlap between the two is maximized for a given grouping of dyadic data.
best_match_new(overlap_dyad_output, id1)
overlap_dyad_output |
The outputted data frame from the overlap_dyad_creatr function |
id1 |
The ID field (chr) from the first shpfile of interest. |
id2 |
The ID field (chr) from the second shpfile of interest. |
census_fields |
The string vector of other population fields of interest referring to census data that should be caclulated, which amounts to the raw weighted number of the individuals part of the demographic in question residing within the overlap of the two shpfile polygons of interest |
The data frame with the dyadic population overlap between the first and second shapefiles. The following are the values:
id1 = The renamed id field from the first shpfile
id2 = The renamed id field from the second shpfile
correctly_matched_pop = The numeric field of the estimated number of people residing between within the overlying area between the shp1 polygon and the shp2 polygon with the highest degree of overlap.
zctas <- arealOverlapr::zctas cbg_oh <- arealOverlapr::cbg_oh oh_sen <- arealOverlapr::oh_sen test_overlap <-weight_overlap(shp1 = zctas, shp_atom = cbg_oh, shp2 = oh_sen, pop_field = "POP2010") test_output <- overlap_dyad_creatr(test_overlap, id1="ZCTA5CE10",id2="id", census_fields = c("WHITE","BLACK","MALES")) test_best <- best_match_new(test_output, "id1") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.