首选用dplyr包
查看hr有哪些字段名
> names(hr)
[1] "satisfaction" "evaluation" "project" "monthlyhour" "serviceyear" "accident" "left" "promotion" "dept" "salary" "SG"
引入dplyr包
> library(dplyr)
“%>% select”
> hr_cor <- hr %>% select(satisfaction:promotion,SG)
检查hr_cor的字段
> names(hr_cor)
[1] "satisfaction" "evaluation" "project" "monthlyhour" "serviceyear" "accident" "left" "promotion" "SG"
时间: 2024-11-08 20:12:43