Good Morning,
I am trying to get side by side boxplots of two groups on the same variable. The last item under ?boxplot led me to some useful code. I use "boxwex" to make the boxes narrower, "at" to shift them over and "add" to draw them both on the same graph. Something along the lines of:

attach(group1)
boxplot(Y~X, col="blue", boxwex=.4, at=1:n+.2)
attach(group2)
boxplot(Y~X, col="red", boxwex=.4, at=1:n-.2, add=TRUE)

When I just make up a small dataset to try this out on it works great. My problem is that I don't have completely matching data in the real dataset. Every instance of the variable does not have data present from both groups. When they get put on top of each other they don't line up. Can I do something with my data to make it line up correctly using this approach? Is there another way of getting the same results?

Thanks,
Phillip

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to