[R] boxplot help

Rui Barradas ruipbarradas at sapo.pt
Wed Aug 15 20:08:17 CEST 2012


Hello,

I'm not sure wether this is what you want, but here it goes.

dd <- structure( ...etc... )  # your dataset

# make group identifiers
ym <- paste(dd$Year, as.character(dd$Month), sep="-")

op <- par(las=2) # make labels perpendicular to axis
bp <- boxplot(Temp ~ ym, data=dd)
axis(1, at = seq_along(unique(ym)), labels = bp$names)
par(op)

If it's what you want, add color and legend.

Hope this helps,

Rui Barradas

Em 15-08-2012 17:52, andyspeak escreveu:
> hi thanks
>
> the dput output is...
>
> structure(list(Year = c(2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L,
> 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L, 2011L), Month =
> structure(c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L), .Label = c("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun",
> "Mar", "May", "Nov", "Oct", "Sep"), class = "factor"), Roof =
> structure(c(3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L), .Label = c("BARE", "TT13", "TT6"), class = "factor"), Temp = c(10.68,
> 11.8, 12.16, 12.36, 12.5, 12.58, 12.46, 12.72, 12.31, 12.35,
> 12.44, 12.59, 12.86, 13.05, 13.83, 13.92, 14.24, 14.47, 13.84,
> 13.44, 12.83, 12.73, 12.47, 12.18, 12.59, 12.36, 12.09, 11.73,
> 13.02, 13.16, 13.21, 13.53, 14.15, 14.67, 15.53, 15.48, 17.43,
> 18.56, 22.6, 25.06, 20.36, 18.78, 15.29, 11.98, 10.23, 9.42,
> 8.38, 7.37, 6.47, 6.3)), .Names = c("Year", "Month", "Roof",
> "Temp"), row.names = c(NA, 50L), class = "data.frame")
>
> But as this is only first 50 rows then it doesnt show that some of the data
> is Jan - Jul of 2012 which i want displaying separately from Apr-Jul 2011
> data.
>
> I think the next reply i recieved points me to a good solution.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/boxplot-help-tp4640360p4640392.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list