I have the following table. With 'a' and 'b' on a likert scale from 1-5.
type | a | b |
---|---|---|
typeOne | 2 | 3 |
typeTwo | 4 | 4 |
typeOne | 5 | 2 |
Now I try to visualize the data as seen here in two groups (typeOne, typeTwo) and with 'a' and 'b' on the y-axis.
Unfortunately when I run my factor code all numeric values vanish from the table and get replaced by 'NA'.
My code is:
df <- as.data.frame(data)
factorLevels <- c('Strongly Disagree', 'Disagree', 'Neither', 'Agree', 'Strongly Agree')
df[2:3] <- lapply(df[2:3], factor, levels=factorLevels)
library(likert)
df_likert <- likert(df[,c(2:3)], grouping = df$type)
plot(df_likert)
When I run the plot command I get the following error:
argument must be coercible to non-negative integer