In rgdal
you have to name a layer destination (dsn
) and a layer name (layer
).
In case of a shapefile located at /home/user/folder/shapefile.shp
that would be dsn = "/home/user/folder"
and layer = "shapefile"
So you should use it like this:
mapfile <- readOGR("/Users/kajoribanerjee/Documents/PhD/bayesian geoadditive model",
"india_2011")
You should also have a look at ?readOGR
where it is stated that:
If reading a shapefile, the data source name (dsn
= argument) is the folder (directory) where the shapefile is, and the layer is the name of the shapefile (without the .shp extension)
Another way is shown here by using raster::shapefile
.