u_shpsplitR
takes an ESRI shape file and splits it into multiple shape
files based on unique entries in a field of the attribute table.
u_shpsplitR(pathin, pathout = paste0(pathin, "/site_vectors"), layer, attrb)
pathin | Character string filepath to the location of the shape file. |
---|---|
pathout | Character string filepath to the write location. |
layer | Character string of the name of the shape file (no extension). |
attrb | Character string of the name of the field in the attribute table of the shape file that contains the unique entries (e.g.site numbers). |
Creates multiple ESRI shape files each named after the unique entry found in 'attrb' and saves them to a folder (defaults to "site_vectors"). It will also write a text file with the name of the original layer file used and output names of new layers created to screen or to object if created.
# NOT RUN { u_shpsplitR(layer = "plot_locations", attrb = "Plot_ID") # }