Read shapefile from a folder
Arguments
- folder
path of folder that contains the files (.shp, .shx, .dbf, and .prj)
- cleanit
set to FALSE if you want to skip validation and dropping invalid rows
- crs
passed to shapefile_from_filepaths() default is crs = 4269 or Geodetic CRS NAD83
- ...
passed to
sf::st_read()
Examples
# \donttest{
testfolder <- system.file("testdata/shapes/Portland_neighborhoods", package = "EJAM")
testshape <- shapefile_from_folder(testfolder)
#> Warning: No basename found -- returning NULL
#> Warning: need vector of full paths and filenames that must include all these extensions .shp, .shx, .dbf, and .prj
testpaths <- shapefile_filepaths_from_folder(testfolder)
testshape <- shapefile_from_filepaths(testpaths)
#> Warning: No basename found -- returning NULL
#> Warning: need vector of full paths and filenames that must include all these extensions .shp, .shx, .dbf, and .prj
## if interactive(), R user can point to right folder or select the right set of files:
# testshape <- shapefile_from_filepaths()
# testshape <- shapefile_from_folder()
x <- get_blockpoints_in_shape(testshape)
#> Error in `[.data.frame`(x, i): undefined columns selected
leaflet::leaflet(x$polys) %>% leaflet::addTiles() %>% leaflet::addPolygons(color = "blue")
#> Error in leaflet::leaflet(x$polys) %>% leaflet::addTiles() %>% leaflet::addPolygons(color = "blue"): could not find function "%>%"
DT::datatable(out$results_bysite)
#> Error: object 'out' not found
# }