I have a directory of shape-files with identical data scheme, which I like to read and combine into one layer.
Reading in:
library(sf)
library(dplyr)
# create list of file names from directory
names.shapes <- list.files(path=PATH_TO_DIRECTORY,pattern = "\\.shp$")
#read layers into list of layers
lstShapes <- lapply(paste(PATH_TO_DIRECTORY,names.shapes,sep="/"), st_read)
#adding file names to list items
names(lstShapes) <- names.shape
I could now merge the layers from the list with
result <- bind_rows(lstShapes)
Unfortunately, the layers are of mixed geometry types. There is a point layer among several polygon layers. Of course I could "manually" select this point layer, and e.g. by buffering convert it onto a polygon layer as well, but I am searching for a programatical way to select/filter the non-polygon features from the simple feature data frame resulting from bind_row and only buffer those to get an all-polygon layer I can export as a GIS-layer
So far, I can't find a way to filter and buffer the point features within the sf data frame.