summarizeClusters {geocmeans} | R Documentation |
Descriptive statistics by group
Description
Calculate some descriptive statistics of each group
Usage
summarizeClusters(data, belongmatrix, weighted = TRUE, dec = 3, silent = TRUE)
Arguments
data |
The original dataframe used for the classification |
belongmatrix |
A membership matrix |
weighted |
A boolean indicating if the summary statistics must use the membership matrix columns as weights (TRUE) or simply assign each observation to its most likely cluster and compute the statistics on each subset (FALSE) |
dec |
An integer indicating the number of digits to keep when rounding (default is 3) |
silent |
A boolean indicating if the results must be printed or silently returned |
Value
A list of length k (the number of group). Each element of the list is a dataframe with summary statistics for the variables of data for each group
Examples
data(LyonIris)
AnalysisFields <-c("Lden","NO2","PM25","VegHautPrt","Pct0_14","Pct_65","Pct_Img",
"TxChom1564","Pct_brevet","NivVieMed")
dataset <- sf::st_drop_geometry(LyonIris[AnalysisFields])
queen <- spdep::poly2nb(LyonIris,queen=TRUE)
Wqueen <- spdep::nb2listw(queen,style="W")
result <- SFCMeans(dataset, Wqueen,k = 5, m = 1.5, alpha = 1.5, standardize = TRUE)
summarizeClusters(dataset, result$Belongings)
[Package geocmeans version 0.3.4 Index]