R Likert and Grouped unused levels

298 Views Asked by At

I'm using the R Likert package to generate graphs, which I've used for years but have never come across this bug.

My Likert summary looks fine (generated using likert::likert(dat, grouping = dat$group) :

Group Item Strongly Disagree Disagree Slightly Disagree Slightly Agree Agree Strongly Agree
Group 1 Item 1 0 0 0 0 20 80
Group 1 Item 2 0 0 0 0 20 80
Group 2 Item 1 0 0 0 10 40 50
Group 2 Item 2 0 0 0 20 60 20

However, this will not plot: plot(likert::likert(dat, grouping = dat$group)

Error in seq_len(n) : argument must be coercible to non-negative integer

I'm pretty sure it relates to the grouping/and or the skew in the data, as I can generate a plot for each Group individually no worries, or if I artificially create a new row in my dataset and add a single Strongly Disagree to each item and group, then it works fine, producing the grouped plot with both items?!?!

This only occurs for the bar type, it doesn't happen if I set the density plot option plot(q_ab.s, type = "density")

I've also noticed that if I produce any plot with likert() that has an unused level (common with the small samples I work with), the formatting is totally weird, with a big empty box at the top. I wonder if this is related?

enter image description here

So confused. Any suggestions would be really helpful.

0

There are 0 best solutions below