All Downloads are FREE. Search and download functionalities are using the official Maven repository.

R.hierarchical_clustering.R Maven / Gradle / Ivy

Go to download

Library allowing generation of plots and data from proteomics and metabolomics mass spectrometry data through the use of R and java methods.

The newest version!
hierarchical_clustering <- function(file_in, clusters_number) {
    data_in <- read.delim(file_in, header = T, sep = ",")
    data <- select(data_in, -matches("Groups"))
    
    rownames(data) <- data_in$Groups

    d <- dist(To_Heatmap, method = "manhattan")

    fit <- hclust(d, method = "ward.D")

    par(cex = 0.05)

    plot(fit, main = "Hierarchical Clustering")
    groups <- cutree(fit, k = clusters_number)
    clusters <- as.matrix(groups)
    colnames(clusters) <- "Cluster"
    # use 'merge' in dplyr to reference this back to original input data.
    # draw where the clusters are on the dendrogram:
    rect.hclust(fit, k = clusters_number, border = "green")
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy