dists.mcgf | R Documentation |
mcgf
objectCalculating distance matrices for an mcgf
object
## S3 method for class 'mcgf'
dists(x, return_grid = FALSE, ...)
dists(x) <- value
x |
An |
return_grid |
Logical; used when |
... |
Additional parameters or attributes. |
value |
List of signed distance matrices, outputted from |
If the dists
attribute is available in x
, it will be printed. Otherwise
dists
will be calculated based on the locations
attribute.
A list of signed distance matrices: h
(Euclidean), h1
(horizontal), and h2
(vertical).
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.