[R-sig-Geo] GSTAT
Michael Sumner
mdsumner at utas.edu.au
Mon May 22 04:06:47 CEST 2006
karl.sommer at dpi.vic.gov.au wrote:
> Hello list
>
> In the gstat R package tutorial that accompanies the latest version of
> GSTAT 0.9-29 it is pointed out that the function coordinates, when assigned
> (on the left-hand side of an = or <- sign) promotes the data.frame meuse
> into a SpatialPointsDataFrame. Is there a function that does the opposite
> ie. demote the same data set from SpatialPointsDataFrame back to a
> data.frame?
>
The inverse is to use as.data.frame, which has a methods for
SpatialPointsDataFrame, and restores the coordinates as they were
originally stored, and returns a normal data.frame:
data(meuse)
coordinates(meuse) <- c("x", "y")
## coordinates(meuse) <- ~x+y ## another way
names(meuse) ## x, y now treated as intrinsic data, rather than attributes
## now replace meuse with data.frame version
meuse <- as.data.frame(meuse)
names(meuse)
More information about the R-sig-Geo
mailing list