If the cluster has children, they will be removed too.

remove_cluster(us, cluster, rm_root = FALSE, noise_only = FALSE)

Arguments

us

umapscan object

cluster

label of the cluster to remove

rm_root

if TRUE, also remove the root cluster node. Otherwise, only remove its children

noise_only

if TRUE, only remove 'Noise' nodes

Value

An updated umapscan object (invisibly). Note that the original umapscan object is modified in place.

See also

Examples

library(dplyr) iris_num <- iris %>% select_if(is.numeric) us <- new_umapscan(iris_num, n_neighbors = 25, min_dist = 0.1, seed = 1337) us <- compute_clusters(us, minPts = 3, eps = 0.5)
us <- compute_clusters(us, parent = "3" ,minPts = 3, eps = 0.45)
remove_cluster(us, "3_1")
#> #> Call: new_umapscan(d = iris_num, n_neighbors = 25, min_dist = 0.1, #> seed = 1337) #> #> UMAP embeddings of a 150x4 data frame #> #> Clusters : #> #> levelName #> 1 #> 2 ¦--1 #> 3 ¦--2 #> 4 ¦--3 #> 5 ¦ °--3_1 #> 6 °--<Noise>
us
#> #> Call: new_umapscan(d = iris_num, n_neighbors = 25, min_dist = 0.1, #> seed = 1337) #> #> UMAP embeddings of a 150x4 data frame #> #> Clusters : #> #> levelName #> 1 #> 2 ¦--1 #> 3 ¦--2 #> 4 ¦--3 #> 5 ¦ °--3_1 #> 6 °--<Noise>
remove_cluster(us, "3")
#> #> Call: new_umapscan(d = iris_num, n_neighbors = 25, min_dist = 0.1, #> seed = 1337) #> #> UMAP embeddings of a 150x4 data frame #> #> Clusters : #> #> levelName #> 1 #> 2 ¦--1 #> 3 ¦--2 #> 4 ¦--3 #> 5 °--<Noise>
us
#> #> Call: new_umapscan(d = iris_num, n_neighbors = 25, min_dist = 0.1, #> seed = 1337) #> #> UMAP embeddings of a 150x4 data frame #> #> Clusters : #> #> levelName #> 1 #> 2 ¦--1 #> 3 ¦--2 #> 4 ¦--3 #> 5 ¦ °--3_1 #> 6 °--<Noise>