数据分析:企业员工流失(一)
本文借鉴自公众号:R语言中文社区 Joffy Zhong所作的数据分析实例。
1.相关说明
- 数据集:SAMPLE DATA: HR Employee Attrition and Performance
- 分析语言:R
- 涉及邻域:人力资源管理,员工流失问题
2.数据分析过程
2.1 数据集
该数据集由(1470,35)组成,本文重点关注的具体各列属性值如下图。
2.2 数据分析流程
- 数据初步探索
- 探索基础信息Gender,Age,Department,JobLevel,Education等变量与员工流失的关系
- 探索收入、投入等变量与员工流失的关系
- 探索员工优先认股权,涨薪,升职等变量与员工流失关系
- 探索与满意度相关的变量与员工流失的关系
- 探索工作和生活平衡相关的变量与员工流失的关系
2.3 具体分析过程
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美元
2.3.2 探索Gender,Age,Department,JobLevel,Education等变量与员工流失的关系
g1 <- ggplot(Attr.df, aes(x = Age, fill = Attrition)) +
geom_density(alpha = 0.7)
g2 <- ggplot(Attr.df, aes(x = NumCompaniesWorked, fill = Attrition)) +
geom_density(alpha = 0.7)
g3 <- ggplot(Attr.df, aes(x = YearsAtCompany, fill = Attrition)) +
geom_density(alpha = 0.7)
g4 <- ggplot(Attr.df, aes(x = TotalWorkingYears, fill = Attrition)) +
geom_density(alpha = 0.7)
grid.arrange(g1, g2, g3, g4, ncol = 2, nrow = 2)
结论:
- 离职员工的年龄普遍趋于30岁以下
- 频繁跳槽的员工(离职次数多于5次的)更容易离职
- 在企业时间超过5年,则员工的离职率明显降低
职业生涯低于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