Skip to content
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 in likert(…, grouping = grouping) #16

Closed
andreaphsz opened this issue Oct 30, 2013 · 7 comments
Closed

error in likert(…, grouping = grouping) #16

andreaphsz opened this issue Oct 30, 2013 · 7 comments

Comments

@andreaphsz
Copy link

likert() throws an error, if there is a variable with unused levels, and grouping is used.

library(likert)
library(reshape)

df <- data.frame(matrix(c(1,1,1,1,2,1,2,2), 4))

df[,1] <- factor(df[,1], 1:2)
df[,2] <- factor(df[,2], 1:2)

gr <- c(1,1,2,2)

likert(df, grouping=gr, nlevels=2)

output is:

Error in fix.by(by.y, y) : 'by' must specify uniquely valid columns
@jbryer
Copy link
Owner

jbryer commented Nov 14, 2013

This issue has been fixed and a test was added to the UnusedLevels demo. Problem seem to be more related to using a numeric vector type for the group assignment.

@jbryer jbryer closed this as completed Nov 14, 2013
@patilv
Copy link

patilv commented Nov 9, 2015

I am having the same problem show up and the example in the demo is also throwing the same error.

@josiahpjking
Copy link

Not sure why, but detaching the reshape package solved this for me.

@jbryer
Copy link
Owner

jbryer commented Nov 12, 2015

I just recently updated the package to use reshape2 instead of reshape given that ggplot2 uses the latter now. I do explicitly call reshape2::melt but if reshape is also loaded, there is a conflict somewhere in the namespace. I believe it has to do with the fact that the class type returned by both are the same so the wrong S3 method is being dispatched. My advice, abandon reshape and stick with reshape2. I believe that RStudio and Hadley have done.

@patilv
Copy link

patilv commented Nov 12, 2015

Detaching reshape did it for me as well. Thanks for the tip. I believe the reshape2 tasks are now predominantly going to be done using tidyr. So we could go to the gather function to do what melt does. I will take a closer look at the package code sometime soon. Thanks for the great work on this.

@jbryer
Copy link
Owner

jbryer commented Nov 12, 2015

Great! Glad it worked. I finally get around to update to reshape2 and
Hadley has another way of doing things. ;-)

-Jason

On Thu, Nov 12, 2015 at 9:17 AM, Vivek Patil notifications@github.com
wrote:

Detaching reshape did it for me as well. Thanks for the tip. I believe the
reshape2 tasks are now predominantly going to be done using tidyr. So we
could go to the gather function to do what melt does. I will take a closer
look at the package code sometime soon. Thanks for the great work on this.


Reply to this email directly or view it on GitHub
#16 (comment).

@raynamharris
Copy link

Thanks! I detached reshape then loaded reshape2 and all was well

detach("package:reshape", unload=TRUE)
library("reshape2")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants