Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nlevels=5 not working when grouping? #49

Closed
jeffrosenblum opened this issue Dec 20, 2015 · 1 comment
Closed

nlevels=5 not working when grouping? #49

jeffrosenblum opened this issue Dec 20, 2015 · 1 comment

Comments

@jeffrosenblum
Copy link

Hi,
For a smaller dataset, some questions do not have at least one response for each of the likert scale ratings. When plotting the whole dataset, adding nlevels=5 works fine. But when introducing a grouping, the nlevels=5 command seems to be ignored. Note below the question "Workshop participants discussed issues in an open way." There were no "1" or "2" responses. The first graph takes care of that. The second does not, it assumes the values "3" "4" and "5" are actually "1" "2" and "3".

x.overall.order <- c(1,2,3,4,6,7,8,9,11,5,10)
x.overall <- survey.df[,c(22:32)][x.overall.order]
t <- likert(x.overall, nlevels=5)
o=names(x.overall)
my.plot <- plot(likert(x.overall, nlevels=5),ordered=FALSE, group.order=o,wrap=70) + ggtitle(paste("Post-workshop survey"))
my.plot
ggsave(paste("overall0.png"), plot = my.plot, width = 13, height = 6)

overall0

x.overall.order <- c(1,2,3,4,6,7,8,9,11,5,10,12)
x.overall <- survey.df[,c(22:32,69)][x.overall.order]
x.overall[,12] <- gsub("0", "No Viz", x.overall[,12])
x.overall[,12] <- gsub("1", "Viz", x.overall[,12])
l <- likert(x.overall[,1:11], nlevels=5, grouping = x.overall$viz)
l
my.plot <- plot(l,ordered=FALSE, wrap=90) + ggtitle(paste("Post-workshop survey, by Viz"))
my.plot

overall

@jbryer
Copy link
Owner

jbryer commented Mar 5, 2019

I think if the items were coded as factors before calling likert, it will work properly. Not sure how to handle this since the functions do not known that there are no categories if there is no levels set (i.e. the variables needs to be a factor).

@jbryer jbryer closed this as completed Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants