class_geocontainer_accessors: GeoContainer: get or set slots

Description Usage Arguments Details Value See Also

Description

Get or set the values stored in slots of an object of class GeoContainer.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
crs(x)

xcol(x)

ycol(x)

xy(x, ...)

crs(x) <- value

xcol(x) <- value

ycol(x) <- value

## S4 method for signature 'GeoContainer'
crs(x)

## S4 method for signature 'GeoContainer'
xcol(x)

## S4 method for signature 'GeoContainer'
ycol(x)

## S4 method for signature 'GeoContainer'
xy(x, simplify = TRUE)

## S4 replacement method for signature 'GeoContainer,CRS'
crs(x) <- value

## S4 replacement method for signature 'GeoContainer,numeric'
crs(x) <- value

## S4 replacement method for signature 'GeoContainer,character'
xcol(x) <- value

## S4 replacement method for signature 'GeoContainer,character'
ycol(x) <- value

Arguments

x

conceptually, any R object.

...

further arguments passed to or from methods.

value

depends of the function used.

  • For xcol<-() and ycol<-(), a character of length 1.

  • For crs<-(), a numeric value of length 1 that can be parsed to an integer or an object of class sp::CRS.

simplify

a logical. If TRUE, the output is coerced to a numeric matrix. Else, a data.table is returned.

Details

Functions xcol<-() and ycol<-() update the underlying column names of slot table by reference through a call to setnames().

The xy() accessor function

The xy() function extracts spatial coordinates from an object of class GeoContainer. Indeed, xy is not a formal slot, but it is defined here for convenience because it is closely related to slots xcol and ycol.

Value

xcol() and ycol() return a character of length 1.

crs() returns an object of class sp::CRS.

xy() returns a numeric matrix if simplify is TRUE and a data.table if simplify is FALSE. Both outputs have two columns named after slots xcol and ycol.

Functions xcol<-(), ycol<-() and crs<-() update x and return its updated version invisibly.

See Also

Other GeoContainer: GeoContainer-class, GeoContainer-methods, GeoContainer-validators, is_geocontainer()


jeanmathieupotvin/cargo documentation built on Oct. 27, 2020, 5:22 p.m.