I want to read a shapefile(polyline) into R, using rgdal and raster packages.
The code looks like:
d<-file("/Volumes/Environment_layers/original/WaterRoad/Road.shp")
o<-shapefile(d)
but I got a warning:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘shapefile’ for signature ‘"file"’
I am new in using R dealing with spatial layers.
file
on the path and passed afile
object (hence the error). I suspect this might be a pythonic paradigm from someone used to python. Either way, its a specific error that other people might encounter and so is worth having as a question as my explanation details the solution.