View source: R/overlap_dyad_creatr.R
overlap_dyad_creatr | R Documentation |
This function takes the raw output of the weight_overlap function (also part of the arealOverlapr pkg), and calculates the population overlap between two levels of geography, and the demographic information of interest from census data.
overlap_dyad_creatr(weight_output, id1, id2, census_fields)
weight_output |
The outputted data frame from the weight_overlap 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 |
shp_atom |
The atomic unit of geography shpfile that will be used to calculate the spatial weights by population |
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
pop_wt = The summed weighted population estimated to reside between the two shpfiles of interest
census_fields_wt = The vector of census fields with "_wt" pasted to reflect the population estimated from the chosen census fields.
shp1pop = The total estimated population residing within the first level of geography
overlap1 = The degree of nestedness of the first level of geography within the second level, 0 - 1.
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")) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.