我有很多数据框,我必须按序数李克特尺度变量进行过滤。而不是选择它们x == "Strongly disagree" | x == "Disagree"
等等,我想选择它们x < 3
。我怎样才能做到这一点?
xl <- sample(1:5, 20, replace = T)
x <- factor(xl,labels=c("Strongly disagree","Disagree","Neither agree nor disagree","Agree", "Strongly agree"),ordered=TRUE)
y<-sample(2:40,20)
z<-data.frame(x,y)
a<-subset(z,x == "Strongly disagree" | x == "Disagree")
a
谢谢