Description Usage Arguments Details Examples
Calculates Earth-mover's distance for a list of rasters
1 |
r_list |
|
mat |
|
check_symmetric |
|
EMD calculations are symmetric, i.e., emd(x, y) == emd(y, x)
.
These calculations are time-consuming, so you will probably want to avoid
providing a symmetric matrix. The argument check_symmetric
defaults to
TRUE
and causes the function to stop if your matrix is symmetric so you
can correct this before proceeding.
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 | ## Not run:
# Load data
data(tracks)
# Keep only winter data
winter <- tracks[which(tracks$season == "Winter"), ]
# Split by ID
winter_list <- split(winter, winter$id)
# Calculate a for a-LoCoH
a <- a_default(winter_list)
# Fit LoCoHs
locoh_list <- lapply(winter_list, fit_locoh, n = a)
# Rasterize
r_list <- lapply(locoh_list, rasterize_locoh, res = 500)
# Matrix of comparisons
comp <- matrix(0,
nrow = length(winter_list),
ncol = length(winter_list))
comp[1, 2] <- comp[2, 3] <- comp[3, 4] <- 1
# Calculate EMD
EMD <- calc_emd(r_list, mat = comp)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.