[R-sig-Geo] maybe a new bug in the elide() funcftion for maptools’ version 0.7-2
Roger Bivand
Roger.Bivand at nhh.no
Thu Dec 13 07:47:59 CET 2007
On Thu, 13 Dec 2007, zhijie zhang wrote:
> Dear Roger,
> There maybe a new bug in the new elide() funcftion for maptools' version
> 0.7-2, which was correct in the former version. See below.
Again correct - please simply replace the elide()ed object data slot with
the original.
Roger
> #Example in the help page
> data(meuse)
> coordinates(meuse) <- c("x", "y")
> proj4string(meuse) <- CRS("+init=epsg:28992")
> data(meuse.riv)
> river_polygon <- Polygons(list(Polygon(meuse.riv)), ID="meuse")
> rivers <- SpatialPolygons(list(river_polygon))
> proj4string(rivers) <- CRS("+init=epsg:28992")
>
> ##maptools' version 0.7-2, the transformed dataset dropped two variables in
> the rightmost: landuse and dist.m.
> meuse1 <- elide(meuse, bb=bbox(rivers), scale=TRUE)
>> meuse[1,]
> coordinates cadmium copper lead zinc elev dist om ffreq soil
> lime landuse dist.m
> 1 (181072, 333611) 11.7 85 299 1022 7.909 0.00135803 13.6 1
> 1 1 Ah 50
>> meuse1[1,]
> coordinates x y cadmium copper lead zinc elev
> dist om ffreq soil lime
> 1 (0.23093, 0.660129) 181072 333611 11.7 85 299 1022 7.909
> 0.00135803 13.6 1 1 1
>
> ##maptools' version 0.6-19 + original elide() function: i can't found the
> former version for maptools package with elide() function, but i use the
> elide() function that you sent me for the 1st time to show its results. You
> can try the former version.
> meuse1 <- elide(meuse, bb=bbox(rivers), scale=TRUE)
>> meuse[1,]
> coordinates cadmium copper lead zinc elev dist om ffreq soil
> lime landuse dist.m
> 1 (181072, 333611) 11.7 85 299 1022 7.909 0.00135803 13.6 1
> 1 1 Ah 50
>> meuse1[1,] #it didn't drop any variables
> coordinates cadmium copper lead zinc elev dist om ffreq
> soil lime landuse dist.m
> 1 (0.23093, 0.660129) 11.7 85 299 1022 7.909 0.00135803 13.6
> 1 1 1 Ah 50
>
> The reason maybe the latest version remains the original x/y coordinates
> that resulted in overlaying the rightmost two variables, while the former
> version dropped the original x/y coordinates . So i think two additional
> colunms maybe needed there.
> Thanks.
>
>
>
>
--
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