[R-sig-Geo] Problems wirh R 3.0.1 and maptools

MacQueen, Don macqueen1 at llnl.gov
Tue Aug 27 00:46:58 CEST 2013


What happens if you try these, derived from the examples in ?rgdal:

## from ?readOGR
dsn <- system.file("vectors", package = "rgdal")[1]

## then read two of the shapefiles in that directory
cit <- readOGR(dsn,'cities')
plot(cit)

tmp <- readOGR(dsn,'trin_inca_pl03')
plot(tmp)


They work for me, also having recently upgraded to R 3.0.1 on a Mac.

I see that error message from time to time, and if I recall correctly it
usually has something to do with which packages I have (or don't have)
attached. 

Similar to what Lee said, I would make sure you have up to date versions
of everything that maptools and rgdal depend on.

Compare with the versions I have:
> require(rgdal)
Loading required package: rgdal
Loading required package: sp
rgdal: version: 0.8-10, (SVN revision 478)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.9.2, released 2012/10/08
Path to GDAL shared files:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/rgdal/proj



I'd also suggest including the the output of sessionInfo() in your posts
(standard practice for all requests for R help)

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/17/13 1:20 PM, "sara martino" <saramartino at yahoo.com> wrote:

>Hi
>i am new to using shapefiles in R. I just want to plot some maps and I
>used to do it as: 
>
>
>shp=readShapeSpatial("file.shp")
>plot(shp)
>
>using maptools or 
>
>
>shp <-readOGR("path/to/shpfiles","IND_adm2")plot(shp)
>
>using rgdal.
>
>I have now upgraded to R 3.0.1 and since then everytime i try to plot the
>shapefile i get the error:
>
>Error in as.double(y) :
>cannot coerce type 'S4' to vector of type 'double'
>
>I get the same error also if i try to reproduce the example in
>>?readShapeSpatial.
>
>Can anyone tell me what is the problem?
>thanks
>sara
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list