jbryer/likert — pull request #8 by houshuang (2013-09-01 18:56:52+00:00)
Title: Fixing a bug where NAs in column would cause problems with plot/summary ...

I had a bunch of columns with some NAs, likert would work, but it plot() and summary() would fail with the message:

Error in `$<-.data.frame`(`*tmp*`, "low", value = c(15.4761904761905, :
replacement has 10 rows, data has 5

It turns out that it generated an extra NA level in R/likert.R#53

Group = rep(unique(grouping), each=nlevels),
Response = rep(1:nlevels, length(unique(grouping)))

unique(grouping) would be equal to Male, Female, NA.

I changed it to unique(na.omit(grouping)), and it worked perfectly. Not sure if this could cause other problems though.