我有以下数据框:
df <- structure(list( data = structure(1:10, .Label = c("Ind_1", "Ind_2", "Ind_3" , "Ind_4" , "Ind_5" , "Ind_6"
, "Ind_7" , "Ind_8" , "Ind_9" , "Ind_10" ), class = "factor"),
hoursworked_week = c(4,9,12,45,23,18,23,45,16,7), job_status = c(4,2,1,7,4,5,3,2,4,4)),
class = "data.frame", row.names=c(NA,-10L))
data hoursworked_week job_status
1 Ind_1 4 4
2 Ind_2 9 2
3 Ind_3 12 1
4 Ind_4 45 7
5 Ind_5 23 4
6 Ind_6 18 5
7 Ind_7 23 3
8 Ind_8 45 2
9 Ind_9 16 4
10 Ind_10 7 4
我想计算有hoursworked_week <= 20 & job_status == 4
我尝试过
count(df$hoursworked_week <= 20 & df$job_status == 4
,但无效