dists.mcgf {mcgf} | R Documentation |
Calculating distance matrices for an mcgf
object
Description
Calculating distance matrices for an mcgf
object
Usage
## S3 method for class 'mcgf'
dists(x, return_grid = FALSE, ...)
dists(x) <- value
Arguments
x |
An |
return_grid |
Logical; used when |
... |
Additional parameters or attributes. |
value |
List of signed distance matrices, outputted from |
Details
If the dists
attribute is available in x
, it will be printed. Otherwise
dists
will be calculated based on the locations
attribute.
Value
A list of signed distance matrices: h
(Euclidean), h1
(horizontal), and h2
(vertical).
Examples
data <- cbind(S1 = 1:5, S2 = 4:8, S3 = 5:9)
lon <- c(110, 120, 130)
lat <- c(50, 55, 60)
locations <- cbind(lon, lat)
# if locations are longitudes and latitudes
obj <- mcgf(data = data, locations = locations)
obj
dists(obj)
dists(obj) <- dists(obj)
obj
# if locations are just coordinates in a 2D plane:
obj <- mcgf(data = data, locations = locations, longlat = FALSE)
obj
# calculate distances
dists(obj)
# add distances to the `mcgf` object
dists(obj) <- dists(obj)
obj
[Package mcgf version 1.1.1 Index]