0

I tried to make a boxplot today using ggplot2, and I encountered an error I haven't been able to solve, yet. I have used a similar approach (which I actually took from an answer by user @joran) before without incident, but I must be doing something incorrectly this time.

Here is my data:

myboxplot<-structure(list(gap = structure(1:2, .Label = c("Jib", "NoJib"), class = "factor"), Location = structure(c(4L, 4L), .Label = c("A", "B", "C", "D"), class = "factor"), min = c(21.809, 21.081), q1 = c(25.582, 25.375), med = c(28.082, 27), q3 = c(30.142, 28.622), max = c(37.166, 39.808), lab = c(2342L, 119681L)), .Names = c("JibStat", "Location", "min", "q1", "med", "q3", "max", "lab"), row.names = c(2L, 7L ), class = "data.frame")

The code that I have been attempting to use is as follows:

ggplot(myboxplot + aes(x=JibStat, fill=JibStat)) +
      geom_boxplot(aes(lower = q1, upper = q3, middle = med, ymin = min, ymax = max), stat = "identity")

and I get the following error message:

Error in Ops.data.frame(myboxplot, aes(x = JibStat, fill = JibStat)) : list of length 2 not meaningful

I have worked on resolving the issue, but I have not been able to find much on resolving the error. My Google skills must be lacking today, but I can't think of what to search for to get help on this problem. What is it I am doing wrong here?

Additional info: R version 3.0.1, 64-bit Windows 8.

0

1 Answer 1

2

Try changing the first line to:

ggplot(myboxplot, aes(x=JibStat)) +  
    geom_boxplot(aes(lower = q1, upper = q3, middle = med, 
               ymin = min, ymax = max), stat = "identity")

I think you'd mis-typed a comma.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah, how embarrassing. I worked on resolving the error for longer than I care to admit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.