4

我正在使用likertR 中的包来绘制调查数据。对于九个问题中的每一个(每个问题 1-5 的李克特量表),我都按男性和女性对数据进行分组。

在我运行likert命令时创建的列表中,九个调查项目的名称存储为因子变量。但是,当我使用plot命令绘制数据时,图中的面板的顺序与上述因子变量的顺序不同。面板按字母顺序排列,而不是它们的级别顺序。

如何更改面板的顺序?

这是我的likert列表的样子(对不起图片,我不知道如何向您展示数据的样子)。

l_list <- likert(sLik, grouping = subSurv$gender)

l_list 结果图片

当我这样做时str(l_list),它表明这l_list$results$Item是一个有 9 个级别的因素。 str(l_list) 结果的图片

这是输出levels(l_list$results$Item)

[1] "My peers in class"                                    "The course lecturebook."
[3] "The online videos."                                   "The course blog."
[5] "The instructor, by asking asking questions in class." "The instructor, during office hours."                
[7] "Online resources outside blog."                       "Other students not in class."                        
[9] "TAs in tutorial room."  

一切看起来都很好,但是当我尝试绘制它时,图中面板的顺序与我的调查问题的顺序不匹配。

plot(l_list, ordered = FALSE, group.order = c("M","F"))

李克特图结果图片

这是我的数据的缩写版本的 'dput(l_list)' 的输出(以节省空间):

structure(list(results = structure(list(Group = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L), .Label = c("M", "F"), class = "factor"), Item = structure(c(1L, 
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L), .Label = c("My peers in class", "The course lecturebook.", 
"The online videos.", "The course blog.", "The instructor, by asking asking 
questions in class.", 
"The instructor, during office hours.", "Online resources outside blog.", 
"Other students not in class.", "TAs in tutorial room."), class = "factor"), 
`Completely useless` = c(0, 0, 0, 20, 0, 0, 20, 40, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0), `Somewhat useless` = c(0, 0, 0, 
20, 0, 0, 0, 40, 20, 0, 0, 0, 0, 0, 0, 0, 100, 0), `Neither/No opinion` = c(20, 
0, 20, 0, 0, 20, 0, 20, 40, 0, 0, 0, 0, 100, 0, 0, 0, 0), 
`Somewhat useful` = c(60, 60, 20, 60, 0, 0, 60, 0, 20, 100, 
0, 0, 100, 0, 0, 0, 0, 100), `Very useful` = c(20, 40, 60, 
0, 100, 80, 20, 0, 20, 0, 100, 100, 0, 0, 100, 100, 0, 0)), .Names = 
c("Group", 
"Item", "Completely useless", "Somewhat useless", "Neither/No opinion", 
"Somewhat useful", "Very useful"), row.names = c(NA, -18L), class = 
"data.frame"), 
items = structure(list(`My peers in class` = structure(c(5L, 
4L, 4L, 3L, 4L, 4L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `The course lecturebook.` = structure(c(4L, 5L, 
5L, 5L, 4L, 4L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `The online videos.` = structure(c(3L, 5L, 5L, 
5L, 5L, 4L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `The course blog.` = structure(c(1L, 4L, 4L, 
4L, 4L, 2L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `The instructor, by asking asking questions in class.` = 
structure(c(5L, 
5L, 3L, 5L, 5L, 5L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `The instructor, during office hours.` = structure(c(5L, 
5L, 5L, 5L, 5L, 3L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `Online resources outside blog.` = structure(c(4L, 
5L, 5L, 4L, 1L, 4L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `Other students not in class.` = structure(c(2L, 
1L, 2L, 3L, 1L, 2L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor")), `TAs in tutorial room.` = structure(c(5L, 2L, 
4L, 3L, 4L, 3L), .Label = c("Completely useless", "Somewhat useless", 
"Neither/No opinion", "Somewhat useful", "Very useful"), class = 
c("ordered", 
"factor"))), .Names = c("My peers in class", "The course lecturebook.", 
"The online videos.", "The course blog.", "The instructor, by asking asking 
questions in class.", 
"The instructor, during office hours.", "Online resources outside blog.", 
"Other students not in class.", "TAs in tutorial room."), row.names = 
386:391, class = "data.frame"), 
grouping = structure(c(1L, 1L, 2L, 1L, 1L, 1L), .Label = c("M", 
"F"), class = "factor"), factors = NULL, nlevels = 5L, levels = 
c("Completely useless", 
"Somewhat useless", "Neither/No opinion", "Somewhat useful", 
"Very useful")), .Names = c("results", "items", "grouping", 
"factors", "nlevels", "levels"), class = "likert")

关于如何按我的因子水平l_list$results$Item而不是按字母顺序排列面板的任何想法?

4

0 回答 0