#' agnesPearson
#'
#' @param x [[matrix]] A matrix containg the gene expression.
#' @param k [[numeric]] A integer number indicating the number of clusters.
#'
#' @keywords internal
#' @usage NULL
#' @import cluster
#' @importFrom stats cutree
#' @return [[list]]
agnesPearson <- function(x,k){
distance <- 1 - stats::cor(x = t(x) ,method = "spearman")
agnesObj <- cluster::agnes(x = distance, diss = T, method="gaverage")
assignments <- stats::cutree(agnesObj,k=k)
names(assignments) <- rownames(distance)
return(list("cluster" = assignments))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.