Description Usage Arguments Value Author(s) Examples
View source: R/centroidssummary.R
Returns Centroid summary
1 | centroidssummary(clustereddata)
|
clustereddata |
original dataframe |
centroid
Kaloyan S, kaloyanS@profusion.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ##---- 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)
}
|
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.