R 结合李克特点

R Combine Likert Points

我有一个 10 点李克特量表,如下所示:

    > head(dsidata$Mood_2)
[1] Great Great Bad   Good  Great So-so
Levels: Couldn't be worse Very bad Bad Meh So-so Okay Good Very Good Great Really great

我想要 'merge' 个类别,以便因素的数量减少到 5。选择选项 "Couldn't be worse" 或 "Very bad" 的受访者将被分配到新类别 "Very negative"],等等,直到 10 个因素减少到 5 个。

非常感谢任何帮助

这取决于您的数据集,但您可以这样做:

dsidata$Mood_2_newscale <- ifelse(dsidata$Mood_2 %in% c("Couldn't be worse","Very bad"),
"Very negative",
dsidata$Mood_2)

我确定您的变量已归类为一个因素。所以只需使用这种方法合并一些因素。

set.seed(42)  # for reproducibility

# mimicking your data
df1 <- data.frame(var=rdunif(100, 10))
df1$var <- factor(df1$var, 1:10, labels=c("Couldn't be worse", "Very bad", 
                                        "Bad", "Meh", "So-so", "Okay",
                                        "Good", "Very Good", "Great", 
                                        "Really great"))

df1$var1 <- df1$var

# merging levels
levels(df1$var1) <- list("Very negative"=c("Couldn't be worse", "Very bad"),
                        "negative" = c("Bad", "Meh"),
                        "neutral" = c("So-so", "Okay"),
                        "positive"=c("Good", "Very Good"),
                        "very positive"=c("Great", "Really great"))

屈服

> tail(df1, 10)
                  var          var1
91           Very bad Very negative
92          Very Good      positive
93           Very bad Very negative
94           Very bad Very negative
95  Couldn't be worse Very negative
96  Couldn't be worse Very negative
97               Okay       neutral
98           Very bad Very negative
99          Very Good      positive
100         Very Good      positive