Learn R Programming

sits (version 1.12.0)

sits_cluster_remove: Remove cluster with mixed classes

Description

The function removes clusters according to a percentage threshold "min_perc". A cluster is considered good when the most frequent class has a percentage of samples greater than the "min_perc" threshold.

Usage

sits_cluster_remove(data.tb, min_perc = 0.9)

Arguments

data.tb

A tibble with `cluster` column.

min_perc

Minimum percentage of the most frequent label inside a cluster for the cluster not to be deleted.

Value

A tibble with all selected samples.

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 <- sits_dendrogram (cerrado_2classes, bands = c("ndvi"))
# create 6 clusters by cutting the dendrogram
clusters.tb <- sits_cluster(cerrado_2classes, dendro, k = 6)
# show clusters samples frequency
sits_cluster_frequency(clusters.tb)
# clear those clusters that are less that 25% of each cluster
cleaned.tb <- sits_cluster_remove(clusters.tb, min_perc = 0.70)
# show clusters samples frequency
sits_cluster_frequency(cleaned.tb)
# }

Run the code above in your browser using DataLab