runKmeansClustering.Rd
A wrapper around the Kmeans clustering algorithm. Iterates over all
combinations of ks
and methods_kmeans
and stores the resulting clustering
variables in the feature data.frame.
runKmeansClustering(
object,
ks,
methods_kmeans = "Hartigan-Wong",
prefix = "K",
naming = "{method_kmeans}_k{k}",
n_pcs = NULL,
overwrite = TRUE,
...
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Numeric vector. Denotes all options for k-clusters over which
to iterate. Values <1 are discarded. (Givent o centers
of stats::kmeans()
).
A character vector of kmeans methods. Should be one
or more of c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"). (Given to algorithm
of stats::kmeans()
).
A glue::glue()
instruction on how to name the resulting cluster variables.
use method_kmeans to refer to the method and k for the value of k.
Integer value. The number of principal components to use for the clustering.
Logical value. Must be TRUE
to allow overwriting.
Additional arguments given to stats::kmeans()
.
The updated input object, containing the added, removed or computed results.
library(SPATA2)
data("example_data")
object <- example_data$object_UKF269T_diet
object <- runPCA(object, n_pcs = 20)
object <- runKmeansClustering(object, ks = 3:10, n_pcs = 20)
getFeatureNames(object)