-
Notifications
You must be signed in to change notification settings - Fork 124
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
Error when the amount of factor levels are unequal #5
Comments
This is not a bug but we did add a check to verify the number of levels for all items are the same and providing a better error message. |
I understand it's not a bug and so it's just a suggestion which you can take or leave as you please. I also apologize if It was wrong to raise as an issue when not being a bug. I'm new to Github and so I'm not aware of the "meta gaming" in here. If I however am to use the functions in the package I have to add something like the one suggested above. Below I have inserted the code I use as a supplement to yours and a picture of the plot I get from it
|
No worries on using the bug system. Seems like a fine way to share information. You are not the first to have this issue. I have checked in a demo (can see it here too: https://github.com/jbryer/likert/blob/master/demo/UnusedLevels.R) or type With your specific example, the following would simplify what you have:
This will work now:
Side note, you can also add |
One more thing... have a look at the |
Thanks a lot, the
below is a chunk of code i have used earlier to insert line breaks in levels before plotting. it beats strwrap because it don't mess up the encoding. It functions as follows: After 20 characters, find first whitespace and insert a linebreak. repeat until end
|
I'm glad the demo helped. Regarding your suggestions, both features are On Thu, Aug 1, 2013 at 7:42 AM, Taarnborg notifications@github.com wrote:
|
I've been wrapping my head around this for quite some hours now so i give up. My data.frame: head(a)
str(a)
going through the examples in the demo nothing says I don't have the same number of levels, so I don't understand why the likert command always complains about different levels. Previously this dataframe looked like this:
and I used dplyr to modify it into the likert-friendly format above:
As soon as the data was imported into R, the "value" variable was turned into a factor with 5 levels. |
Couple of notes:
|
Hi I get an error when creating a plot item using the likert function. The error occurs because the factor levels in each variable differs, This is however not a mistake but just a result of small survey data. And in theory it could happen with larger data sets as well. (see example below)
I would like to suggest adding to your function a way to deal with this. Below is a code that provides the "missing levels". However its not ready to be implemented with your code yet. But maybe you'll have a better take on that than me?
The text was updated successfully, but these errors were encountered: