本文借鉴自公众号:R语言中文社区 Joffy Zhong所作的数据分析实例。
1.相关说明 数据集:SAMPLE DATA: HR Employee Attrition and Performance分析语言:R涉及邻域:人力资源管理,员工流失问题 2.数据分析过程 2.1 数据集该数据集由(1470,35)组成,本文重点关注的具体各列属性值如下图。
2.3.1 数据初步探索
#加载数据并初步探索Attr.df <- read.csv("D:/R/Rcodes/data/HR-Employee-Attrition.csv",header = TRUE)str(Attr.df)summary(Attr.df)
结论:
- 离职员工:非离职员工=1:5
- 企业员工平均年龄为37岁
- 企业男女比例约为1:1.5
- 企业员工收入平均值为6503美元,中值为4919美元
结论:
职业生涯低于10年的员工离职倾向更大
在此推测,由于年轻的员工更倾向于多尝试,且对未来目标相对迷茫,高流失率也意味着此类员工难以在短期形成对企业价值观的长期认同。因此企业应多关注年轻员工,传播企业文化,加强员工的归属感和认同感。
g5 <- ggplot(Attr.df, aes(x= Gender,fill = Attrition)) + geom_bar(position = "fill") + labs(y="Percentage") + scale_y_continuous(labels=percent)g6 <-ggplot(Attr.df, aes(x= JobLevel,fill = Attrition)) + geom_bar(position = "fill") + labs(y="Percentage") + scale_y_continuous(labels=percent)g7 <- ggplot(Attr.df, aes(x= Education,fill = Attrition)) + geom_bar(position = "fill") + labs(y="Percentage") + scale_y_continuous(labels=percent) g8 <- ggplot(Attr.df, aes(x= Department,fill = Attrition)) + geom_bar(position = "fill") + labs(y="Percentage") + scale_y_continuous(labels=percent)grid.arrange(g5, g6, g7, g8, ncol = 2, nrow = 2)
结论:
在企业的各部门中,销售部门的员工离职率更高
在此推测,企业应多关注一线的销售人员,深入了解该部门的人员制度安排以及福利水平。
2.3.3 探索收入、投入等变量与员工流失的关系 g9 <- ggplot(Attr.df, aes(x = MonthlyIncome, fill = Attrition)) + geom_density(alpha = 0.7) g10 <- ggplot(Attr.df, aes(x= JobInvolvement, group=Attrition)) + geom_bar(aes(y = ..prop.., fill = Attrition), stat="count", alpha = 0.7,position = "identity",color="black") + labs(y="Percentage") + scale_y_continuous(labels=percent)grid.arrange(g9, g10, ncol = 2)
结论:
工作投入高的员工离职可能性更高
在此推测,企业底层的员工由于工资低,流动性更大;相对于10000美元的企业高管精英,有可能是为了追求更大的平台而出现跳槽的情形,这类员工往往会影响企业的正常发展,因此企业应重点关注,及时了解其动态及需求。
ggplot(Attr.df, aes(x= JobInvolvement, y=MonthlyIncome, group = JobInvolvement)) + geom_boxplot(aes(fill = factor(..x..)),alpha=0.7) + theme(legend.position="none",plot.title = element_text(hjust = 0.5)) + facet_grid(~Attrition) + ggtitle("Attrition")
结论:
投入与回报差异较大的,越容易流失,因此企业更需要关注那些投入多但回报少的员工,这类员工也许不是不努力,而是没有掌握正确的工作方式,应当给予更大的帮助,例如培训,工作指导等;薪资往往是回报的其中一种。
结论:
在此推测,加薪、培训、和升职对员工影响不大,员工优先认股权对于员工来源是更为有效的手段,有认股权的员工相对来说较稳定,将企业利益与员工个人利益捆绑在一起,能使员工有归属感。 2.3.5 探索与满意度相关的变量与员工流失的关系 g15 <- ggplot(Attr.df, aes(x= JobSatisfaction, group=Attrition)) + geom_bar(aes(y = ..prop.., fill = Attrition), stat="count", alpha = 0.7,position = "identity",color="black") + labs(y="Percentage") + scale_y_continuous(labels=percent) g16 <- ggplot(Attr.df, aes(x= RelationshipSatisfaction, group=Attrition)) + geom_bar(aes(y = ..prop.., fill = Attrition), stat="count", alpha = 0.7,position = "identity",color="black") + labs(y="Percentage") + scale_y_continuous(labels=percent) g17 <- ggplot(Attr.df, aes(x= EnvironmentSatisfaction, group=Attrition)) + geom_bar(aes(y = ..prop.., fill = Attrition), stat="count", alpha = 0.7,position = "identity",color="black") + labs(y="Percentage") + scale_y_continuous(labels=percent) grid.arrange(g15, g16, g17, ncol = 2)
结论:很明显满意度低的员工离职率更高。
结论:
在此推测,工作与生活的平衡这一类因素对员工流失的影响较为严重,经常加班,出差以及离家较远都会造成员工离职,因此企业应更加人性化管理,提高工作效率,避免加班等问题。
数据分析:企业人力资源管理探索(未完待续)