I follow this tutorial and try to read this shp file.
I try several ways in R but fail.
I also read this answer from SO but it doesn't help me.
chi.poly <- maptools::readShapePoly('foreclosures.shp')
#> Warning: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read
#> Error in getinfo.shape(filen): Error opening SHP file
Created on 2018-12-12 by the reprex package (v0.2.1)
So I try readOGR
and st_readError
functions.
file.exists('data/foreclosures.shp')
#> [1] TRUE
chi.poly <- rgdal::readOGR('data/foreclosures.shp')
#> Error in ogrListLayers(dsn = dsn): Cannot open data source
Created on 2018-12-12 by the reprex package (v0.2.1)
file.exists('data/foreclosures.shp')
#> [1] TRUE
chi.poly <- sf::st_readError('data/foreclosures.shp')
#> Error: 'st_readError'不是'namespace:sf'内的出口对象:
Created on 2018-12-12 by the reprex package (v0.2.1)
Anyone know how to do?