[R-sig-Geo] spdep and server

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Dec 1 17:28:42 CET 2011


>> Locus1.gr <- as(Locus1.sp, 'SpatialGridDataFrame')
>
> The first four lines are ok, but the last one gives the following error:
>
> Error in asMethod(object, Class, value) : replace-coercion not allowed
>
> But if I run it on my computer it works. So, why it doesn’t work on a
> server? May be the ‘spdep’ package doesn't work in the same way on linux?

Its nothing to do with spdep because this is only using the sp package
and not spdep.

This is what we call a reproducible example:

 library(sp)
 d=data.frame(x=rep(1:4,4),y=rep(1:4,rep(4,4)),z=runif(16))
 coordinates(d)=~x+y
 d.sp=as(d,"SpatialPixels")
 d.gr=as(d.sp,"SpatialGridDataFrame")

and that works for me. Cut n paste it and see if it works for you.
Then tell us this:

> packageDescription("sp")
Package: sp
Version: 0.9-88
Date: 2011-09-14
[etc]

 I suspect that the version of R and sp is probably old on the server.
Server admins are lazy :)

Barry



More information about the R-sig-Geo mailing list