0

我正在基于由 3 个名义变量和 20 个数值变量组成的数据“college”进行聚类分析。

# select the columns based on the clustering results
cluster_1 <- mat[which(groups==1),]

#"cluster_1" is a data set which is made by cluster analysis consisting of 125 observations.


rbind(cluster_1[, -(1:3)], colMeans(cluster_1[, -(1:3)]))
#This is process of calculating each column's mean and attach the means to the bottom of the data set, "cluster_1".

现在我想知道的是如何计算每一列的样本方差和样本偏差,以及如何将它们附加到数据集“cluster_1”的底部。

请告诉我。

4

1 回答 1

0
  rbind(cluster_1, apply(cluster_1,2,sd), apply(cluster_1, 2, var) )
于 2013-11-29T01:14:48.983 回答