hkclustering (version 1.0.1)

centroidssummary: Returns Centroids summary

Description

Returns Centroid summary

Usage

centroidssummary(clustereddata)

Arguments

clustereddata

original dataframe

Value

centroid

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (clustereddata) 
{
    colnames(clustereddata)[(length(clustereddata))] <- "cluster_number"
    centroids <- aggregate(clustereddata, by = list(clustereddata$cluster_number), 
        FUN = mean)
    clustereddata$counts <- 1
    centroids <- cbind(centroids, aggregate(counts ~ cluster_number, 
        data = clustereddata, FUN = sum))
    centroids <- centroids[, c((length(df) + 2), 2:(length(df) + 
        1), (length(df) + 4))]
    return(centroids)
  }
# }

Run the code above in your browser using DataLab