initSpatial()<-: Set the column names containing spatial data and the corresponding coordinate reference system for a SoilProfileCollection.

getSpatial(): Get spatial data associated with a SoilProfileCollection

# S4 method for SoilProfileCollection,ANY,ANY
initSpatial(object, crs = NULL) <- value

# S4 method for SoilProfileCollection,ANY,character
initSpatial(object, crs = NULL) <- value

# S4 method for SoilProfileCollection
getSpatial(object)

# S4 method for SoilProfileCollection
coordinates(obj)

# S4 method for SoilProfileCollection,ANY
coordinates(object) <- value

# S4 method for SoilProfileCollection,character
coordinates(object) <- value

Arguments

object

A SoilProfileCollection

crs

Optional: character. Representation of Coordinate Reference System as "authority:code", integer EPSG code, WKT2019 or PROJ4 string, an sf crs or sp CRS object.

value

A formula specifying names of columns containing geometry (x and y coordinates), or character with the column names

obj

A SoilProfileCollection

See also

Examples


data(sp5)

# coordinates are stored in x and y column of site
sp5$x <- rnorm(length(sp5))
sp5$y <- rnorm(length(sp5))

# coordinates takes a formula object as input
initSpatial(sp5) <- ~ x + y

# optionally specify Coordinate Reference System (crs) on left-hand side
initSpatial(sp5, crs = "OGC:CRS84") <- ~ x + y