[R] Help with Boxplot

Jim Silverton jim.silverton at gmail.com
Thu Mar 5 18:07:32 CET 2015


I have the following R code for a boxplot. But I keep getting 4 1's, 4 2's
and 4 3's on the x asis for which I reall want to relace the 1's by
agegroup 1 the 2's by age group 2 etc. And I don't want to replce it 4
times just once. Can anyone help.


boxplot(data.all ~ age.group, data = data.plots,
        boxwex = 0.5, at = c(1, 4, 7, 10),
        subset = model.type == 1, col = "yellow",
        main = "Deviation of Predicted from Actual",
        xlab = "Age Groups",
        ylab = "Deviations",
        xlim = c(0.5, 12), ylim = c(-25, 35))
boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
        boxwex = 0.5, at = c(1.7, 4.7, 7.7, 10.7),
        subset = model.type == 2, col = "orange")
boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
        boxwex = 0.5, at = c(2.4, 5.4, 8.4, 11.4),
        subset = model.type == 3, col = "blue")
legend(1, 30, c("regression", "glm", "gam"),fill = c("yellow", "orange",
"blue"))



-- 
Thanks,
Jim.

	[[alternative HTML version deleted]]



More information about the R-help mailing list