0

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.

jpsmith
  • 11,023
  • 5
  • 15
  • 36
  • Did you try using the nlevels argument. Help text says, "number of possible levels. Only necessary if there are missing levels." – stomper May 04 '22 at 01:04
  • Thanks stomper - I did, no effect unfortunately – g.althor May 04 '22 at 01:42
  • It's imperfect, but I kind of got it working. I dropped the missing levels on the factors first. This means I only have 3 categories instead of six, so only the Agree to S. Agree. Plotted. Not ideal by any means. – g.althor May 04 '22 at 04:23

0 Answers0