coordinates.Rd
set spatial coordinates to create a Spatial object, or retrieve spatial coordinates from a Spatial object
coordinates(obj, ...) coordinates(object) <- value
obj | object deriving from class "Spatial" |
---|---|
object | object of class "data.frame" |
value | spatial coordinates; either a matrix, list, or data
frame with numeric data, or column names, column number or a
reference: a formula (in the form of e.g. |
... | additional arguments that may be used by particular methods |
usually an object of class SpatialPointsDataFrame; if the coordinates set cover the full set of variables in object, an object of class SpatialPoints is returned
# data.frame data(meuse.grid) coordinates(meuse.grid) <- ~x+y gridded(meuse.grid) <- TRUE class(meuse.grid)#> [1] "SpatialPixelsDataFrame" #> attr(,"package") #> [1] "sp"bbox(meuse.grid)#> min max #> x 178440 181560 #> y 329600 333760#> [1] "SpatialPoints" #> attr(,"package") #> [1] "sp"