medoidSP | R Documentation |
Find the medoid snowprofile among a group of profiles, based on their pairwise dissimilarity. Either provide a list
of snowprofile
objects, or a precomputed distance matrix.
medoidSP(SPx, distmat = NULL, clustering = NULL, keepDistmat = FALSE, ...)
SPx |
a sarp.snowprofile::snowprofileSet object |
distmat |
If you have a precalculated distance matrix, provide it here to compute the medoid on it. |
clustering |
index of clusters, if provided instead of identifying the medoid profile of the entire snowprofileSet it will return a vector of medoids for each cluster |
keepDistmat |
Do you want to return the pairwise distance matrix? |
... |
arguments passed to distanceSP and then further to dtwSP and simSP |
If providing a large number of profiles without a precomputed distance matrix consider providing a ncores
argument so distanceSP
will calculate alignments in parallel.
If keepDistmat = FALSE
return the (named) index of the medoid snow profile, otherwise return a list with the elements
id.med
and distmat
.
fherla shorton
this_example_runs_about_5s <- TRUE
if (!this_example_runs_about_5s) { # exclude from cran checks
## take a list of profiles
grouplist <- SPgroup2[1:4]
plot(grouplist, SortMethod = 'unsorted', xticklabels = "originalIndices")
## calulate medoid profile
id.med <- medoidSP(grouplist)
representativeProfile <- grouplist[[id.med]]
plot(representativeProfile, main = paste0("medoid (i.e., profile ", id.med, ")"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.