rgdal::readOGR versus readOGR namespace issue?

186 views Asked by At

I am trying to load a shapefile using the the rgdal package. Why is it that this command fails:

plot(rgdal::readOGR(dsn=system.file("vectors/Up.tab", package = "rgdal")[1],layer="Up"))

With error:

Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'

while this one suceeds

library(rgdal)
plot(readOGR(dsn=system.file("vectors/Up.tab", package = "rgdal")[1],layer="Up"))

My guess is that is has something to do with a hidden plot method for SpatialGDAL. How would I uncover what is going on behind the scenes with plot ?

I am trying to call readOGR after "importing" rgdal within a package I am writing. In an effort to avoid namespace conflicts I am using importFrom rgdal readOGR.

0

There are 0 answers