【发布时间】:2019-11-25 04:09:35
【问题描述】:
我有 3 个带有“Av. Mon. Hrs”、“Sat. Lvl”、“Last Eval”的集群对图,并通过以下代码找到了一个矩阵图。
library("ggplot2") # Expanded plotting functionality over "lattice" package
x<-cbind(HR_left$average_montly_hours,HR_left$satisfaction_level,HR_left$last_evaluation)
kmfit<-kmeans(x,3,nstart=25)
# Find the best 3 clusters using 25 random sets of (distinct) rows in x as initial centres.
pairs(x,col=(kmfit$cluster), labels=c("Av. Mon. Hrs","Sat. Lvl","Last Eval."))
上面写着
- 集群 1:配对图将此集群描述为工作量低 平均每月员工小时数、中等满意度范围和 低最后评价。
- 集群 2:从配对图中,该集群是 特点是每月工作时间高、满意度非常低和高 评估。
- 集群 3:从配对图中,该集群是 特点是每月工作时间高、满意度高、 评估。
但我不明白关于它们如何解释这三个发现的配对图。
library(readr)
HR_comma_sep <- read_csv("https://stluc.manta.uqcloud.net/mdatascience/public/datasets/HumanResourceAnalytics/HR_comma_sep.csv")
HR_left<-HR_comma_sep[HR_comma_sep$left==1,]
library("ggplot2") # Expanded plotting functionality over "lattice" package
x<-cbind(HR_left$average_montly_hours,HR_left$satisfaction_level,HR_left$last_evaluation)
kmfit<-kmeans(x,3,nstart=25)
# Find the best 3 clusters using 25 random sets of (distinct) rows in x as initial centres.
pairs(x,col= (kmfit$cluster),labels=c("Av. Mon. Hrs","Sat. Lvl","Last Eval."))
【问题讨论】:
-
请提供样本数据集。
-
库(readr) HR_comma_sep stluc.manta.uqcloud.net/mdatascience/public/datasets/…) HR_left
标签: r ggplot2 cluster-analysis k-means