Closed houshuang closed 10 years ago
Hi, I can confirm the same error pattern.
I have 5 point likert data set. I factored the values. I get outputs from print and summary as expected. But, I get the error "Error in abs(x) : non-numeric argument to mathematical function" when attempting to plot.
I'm willing to help debug as well.
Thanks. I will look into this in the next day or so. Do you have some example code to reproduce the error?
Sure,
The data are 29 indicators, each with numeric levels 1 through 5. The total sample consists of 181 observations.
library(likert)
items29 = mydata[,SEM_VARS] for (i in 1:ncol(items29)) { items29[, i] = factor(items29[, i], levels = 1:5, labels = c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"), ordered = TRUE) }
L29 <- likert(items29) print(L29) summary(L29) plot(L29, type="heat") # this, and any plot function call, gives the error mentioned
Also, let me know if you cannot duplicate the error. I may be able to provide sample data.
Hi there,
Any news on this issue yet? I'd really like to plot my data using your package :-)
Best, Rory
Hi Rory,
Can you provide some sample data? We cannot seem to reproduce this error. Please be sure to install the latest version from github since we have made many changes over the last couple of weeks.
-Jason
On Wed, Jul 17, 2013 at 4:31 AM, openrory notifications@github.com wrote:
Hi there,
Any news on this issue yet? I'd really like to plot my data using your package :-)
Best, Rory
— Reply to this email directly or view it on GitHubhttps://github.com/jbryer/likert/issues/1#issuecomment-21098959 .
We have looked into this further and cannot reproduce the error. There is only one place where we call the abs
function directly and it is for labeling the x-axis (i.e. so the negative values are labelled without the negative sign). That doesn't mean that abs is called somewhere in ggplot2, but without a reproducible example there is no way I can track where in ggplot the error occurred. We have made a number of enhancements in the last couple of weeks including data checks when calling the likert
function. I am curious if those changes have an impact on this issue.
I realize you cannot share your data, but is there anyway to create a sample dataset with the same structure? Can you provide the results of str(mydata)
and str(items29)
(after you convert them to factors in the for loop)? Also, what is value of SEM_VARS
?
Thanks for your help.
The newest version seems to have fixed this issue.
Your library looks great, more flexible than HH likert. I really like the centered plots, but want to be able to do them split over different categories. I was able to create a simple likert item, and also one split by categories, following your example. (My columns are ordered categorical). Printing the likert item, or doing summary() on it works perfectly, but when I try to plot it, I get
Error in abs(x) : non-numeric argument to mathematical function
Traceback: Error in abs(x) : non-numeric argument to mathematical function
(I tried with various plot options). Let me know what I can do to debug this issue further, I'd love to get it to work (unfortunately I can't share the dataset).
Stian