I have data named cluster_1. It has nominal variable from first column to the third.
# select the columns based on the clustering results cluster_1 <- mat[whi
A generalization of what you are doing can be found with the function addmargins. Try, for example:
addmargins
cluster_1Means <- addmargins(cluster_1[, -(1:3)], margin = 1, FUN = mean) cluster_1Means