medoidSP function

Find the medoid snow profile among a group of profiles

Find the medoid snow profile among a group of profiles

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, ...)

Arguments

  • 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

Returns

If keepDistmat = FALSE return the (named) index of the medoid snow profile, otherwise return a list with the elements id.med and distmat.

Details

If providing a large number of profiles without a precomputed distance matrix consider providing a ncores

argument so distanceSP will calculate alignments in parallel.

Examples

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, ")")) }

Author(s)

fherla shorton