【发布时间】:2020-07-10 00:49:53
【问题描述】:
我有一个包含 1000 个员工详细信息的数据框 其中有一列 Tenure 和 Month_count 并且想要匹配 Month1 = 1、Month2 = 2、Month3 = 3 和 Experienced = 4 的条目。如果匹配,我只需要过滤这些行。
name<-c(rep("Bob", 4),rep("Dick", 6),rep("Jack",5),rep("ryan",4))
name<-as.data.frame(name)
Tenure<-c("Month1","Month2","Month3","Experienced","Month2","Month3","Experienced",
"Experienced","Experienced","Experienced","Month1","Month2","Month3","Experienced","Experienced","Experienced","Experienced","Experienced","Experienced")
Tenure<-as.data.frame(Tenure)
Month_count<-c(seq(1:4),seq(2,7,by=1),seq(1:5),seq(1:4))
Month_count<-as.data.frame(Month_count)
total<-cbind(name,Tenure,Month_count)
下面的输入和所需的输出
如果有任何 dplyr 解决方案,我将不胜感激
【问题讨论】: