Clusters the data with one of the following methods:
immunr_hclust
clusters the data using the hierarchical clustering from hcut;
immunr_kmeans
clusters the data using the K-means algorithm from kmeans;
immunr_dbscan
clusters the data using the DBSCAN algorithm from dbscan.
immunr_hclust(.data, .k = 2, .k.max = nrow(.data) - 1, .method = "complete", .dist = TRUE)immunr_kmeans(.data, .k = 2, .k.max = as.integer(sqrt(nrow(.data))) + 1,
.method = c("silhouette", "gap_stat"))
immunr_dbscan(.data, .eps, .dist = TRUE)
immunr_hclust
- list with two elements. The first element is an output from factoextra::hcut.
The second element is an output from factoextra::fviz_nbclust
immunr_kmeans
- list with three elements. The first element is an output from kmeans.
The second element is an output from factoextra::fviz_nbclust.
The third element is the input dataset .data
.
immunr_dbscan
- list with two elements. The first element is an output from fpc::dbscan.
The second element is the input dataset .data
.
Matrix or data frame with features, distance matrix or output from repOverlapAnalysis or geneUsageAnalysis functions.
The number of clusters to create, defined as k
to hcut or as centers
to kmeans.
Limits the maximum number of clusters. It is passed as k.max
to factoextra::fviz_nbclust for immunr_hclust
and immunr_kmeans
.
Passed to factoextra::hcut or as factoextra::fviz_nbclust.
In case of factoextra::hcut the agglomeration method is going to be used (argument hc_method
).
In case of factoextra::fviz_nbclust it is the method to be used for estimating the optimal number of clusters (argument method
).
If TRUE then ".data" is expected to be a distance matrix. If FALSE then the euclidean distance is computed for the input objects.
Local radius for expanding clusters, minimal distance between points to expand clusters. Passed as eps
to dbscan.
data(immdata)
gu <- geneUsage(immdata$data, .norm = TRUE)
immunr_hclust(t(as.matrix(gu[, -1])), .dist = FALSE)
gu[is.na(gu)] <- 0
immunr_kmeans(t(as.matrix(gu[, -1])))
Run the code above in your browser using DataLab