[R-sig-Geo] Error message in spgwr : SpatialPointsDataFrame...row.names of data and coords do not match

Roger Bivand Roger.Bivand at nhh.no
Thu Oct 18 15:08:37 CEST 2007


On Thu, 18 Oct 2007, Dvora-Laiô Wulfsohn wrote:

> Hi
>
> I am (newly) testing out the package spgwr to run GWR in R v. 2.5.1.
>
> I am trying to run the gwr() function with the following command:
>
> model1 <- gwr(Nfix.ma~peaDM.ma, data=gwr.dat, coords=gwr.loc, bandwidth=200,
> +               gweight=gwr.bisquare, hatmatrix=TRUE, se.fit=TRUE)
>
> and get no output, but only the Error message:
>
> Error in SpatialPointsDataFrame(coords = fit.points, data = df, proj4string = CRS(p4s)) :
>        row.names of data and coords do not match
>
> However, a check of rownames() in both my data (gwr.dat) and coords (gwr.loc) reveals no differences between the two.
>
> Perhaps, the error is due to something else altogether related to coordinates in the sp package?
>
> My gwr.loc is a 55x2 matrix (Easting, Northing, 55 locations) and the gwr.dat is a  33x55 data.frame (with the first two columns also containing the Easting, Northing data).

Please try to coerce gwr.dat to a SpatialPointsDataFrame, and omit the 
coords= argument:

coordinates(gwr.dat) <- c(1,2)

should do it. The coords= argument is only retained for backward 
compatibility. If you like, you can send the file from:

save(gwr.dat, gwr.loc, file="rownames_problem.RData")

to me off-list, so that I can trap this particular problem.

Roger

>
> Can anyone advise?
>
> Thanks,
>
> Dvor
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list