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
colMeans() will give you the mean of each column in a data frame or matrix. And rbind() can be used to append the result.
colMeans()
rbind()
rbind(cluster_1[, -(1:3)], colMeans(cluster_1[, -(1:3)]))