borders {edbuildmapr} | R Documentation |
A function to create a file of the borders between neighboring districts
Description
This function allows you to create a dataframe or linestring spatial object of the borders between neighboring districts from any polygon shapefile. It is optimized for school districts in the US, but any polygon shapefile can be used.
Usage
borders(shapefile = "2019", state = NULL, id = "GEOID", diff_var =
"StPovRate", export = "dataframe")
Arguments
shapefile |
The polygon shapefile for which you want to define the borders. To import the school district shapefile for school years between 2013 and 2019, input the four digit year. Import any polygon shapefile by inputting the absolute path to the shapefile on your computer. Defaults to the 2019 school district shapes. |
state |
State name. Can only be used with the school district shapefile. Defaults to NULL to find all borders nationwide. |
id |
Unique variable used to create id for each pair of neighbors. Defaults to GEOID, the unique id in Census data. |
diff_var |
Name of a numeric variable by which to rank the difference between neighbors. Use diff_var = “options” to print a list of the variables. Defaults to "StPovRate", which returns the percentage point difference in Student Poverty Rate. |
export |
The type of object to return, dataframe or shape. Default to dataframe. |
Format
A data frame with 7 variables or spatial object with 8 variables:
- year
data year
- u_id
Unique id of neighbor pair, a compilation of id1 and id2
- id1
Unique id of first district
- id2
Unique id of second district
- length
Length of border in meters for the school district shapefiles, and in the units associated with the projection of the shapefile if the user imports their own shapefile
- diff_var_1
Value of the selected
diff_var
for the first district- diff_var_2
Value of the selected
diff_var
for the second district- diff_in_diff_var
Difference in the selected
diff_var
between district one and two- geography
Linestring spatial object if user selected to export as a shape
Value
A dataframe or spatial object where each observation is a neighboring pair of districts.