Description Usage Arguments Value Examples
Brings in a shapefile (from a directory on the computer) as a SpatialPolygonsDataFrame with a data.table as the data attributes.
1  | shp_to_Rpolygons(shp_dir, shp_layer, id_field, all_data = T)
 | 
shp_dir | 
 The directory where your shapefile is  | 
shp_layer | 
 The name of the shapefile (ex: "census_tracts"), with no .shp or any other extension  | 
id_field | 
 Character string of the column that is the primary key (what defines polygons as being different from one another) in the shapefile. If a field that is not a primary key is provided, the polygons will be collapsed such that there will be 1 polygon object (possibly multi-part) for each of the primary keys you have identified, but the rest of the data table will no longer attach to the shapefile.  | 
all_data | 
 Logical; Whether you want the rest of the data attributes (other than the id_field provided) to remain in the @data slot of the SpatialPolygonsDataFrame.  | 
A SpatialPolygonsDataFrame with a data.table
1  | shp_to_Rpolygons("C:/Users/username/Documents/spatial_data/","shapfile_name","fipscode")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.