2013-11-29 6 views
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"데이터 세트의 맨 아래에 첨부하는 방법을 계산하는 방법이다.

알려 주시기 바랍니다.

+0

디자인 관점에서 볼 때 data.frame의 하단에 요약 통계를 추가하는 것은 매우 나쁩니다. 사과와 오렌지가 들어있어 이제는 데이터에 대해 더 많은 분석을 할 수 없습니다. 그들을 별도의 데이터 구조로 유지하는 것이 좋습니다. – flodel

답변

0
rbind(cluster_1, apply(cluster_1,2,sd), apply(cluster_1, 2, var)) 
+0

고마워요! 나는 "적용"에 관해 알 필요가있다. – user3027252