Learn R Programming

sits (version 1.12.0)

sits_cluster: Cuts a cluster tree produced by sits_dendrogram

Description

reads a list of clusters provided by the dtwclust package, and produces a sits tibble with an added "cluster" column

Usage

sits_cluster(data.tb, dendro.obj, k = NULL, height = NULL)

Arguments

data.tb

A tibble with input data of dtwclust.

dendro.obj

Dendrogram object returned from sits_dendrogram.

k

Desired number of clusters (integer).

height

Desired height to cut the dendrogram (double). At least one of k or height must be specified, k overrides height if both are given.

Value

A tibble with the clusters or clusters' members.

References

"dtwclust" package (https://CRAN.R-project.org/package=dtwclust)

Examples

Run this code
# NOT RUN {
# Load the "dtwclust" package
library(dtwclust)
# load a simple data set with two classes
data(cerrado_2classes)
# calculate the dendrogram
dendro.obj <- sits_dendrogram (cerrado_2classes, bands = c("ndvi"))
# include the cluster info in the sits tibble
clustered.tb <- sits_cluster (cerrado_2classes, dendro.obj, k = 6)
# }

Run the code above in your browser using DataLab