The error is related to the fact that the extension of the dbf file is .DBF
and not .dbf
, so one workaround is just to rename it.
And it's better to use the rgdal::readOGR
function to read shapefile in R.
I have the shape file on my /tmp
folder so change it to your actual path make it work
require(rgdal)
file.copy(from = "/tmp/LIMITE_DEPARTEMENT.DBF",
to = "/tmp/LIMITE_DEPARTEMENT.dbf")
file.remove("/tmp/LIMITE_DEPARTEMENT.DBF")
depart <- readOGR(dsn = "/tmp", layer = "LIMITE_DEPARTEMENT")
str(depart, max.level = 2)
## Formal class 'SpatialLinesDataFrame' [package "sp"] with 4 slots
## ..@ data :'data.frame': 330 obs. of 2 variables:
## ..@ lines :List of 330
## .. .. [list output truncated]
## ..@ bbox : num [1:2, 1:2] 99226 6049647 1242375 7110524
## .. ..- attr(*, "dimnames")=List of 2
## ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots