[R] parallel max, min, and median of dataframe columns

From: H.Jenkins <hjenkins_at_uvic.ca>
Date: Sun, 27 Apr 2008 10:25:25 -0600

Hello, all,

I have a dataframe of three rows and umpteen columns. I want to show the maximum, minimum, and median with a vertical line and a central dot (I'd use a boxplot, but with only three data points, that's overkill; I can't just use points, because of overlap and some of the other data plotted on the graph).

This works:
> boxplot(data_frame, col="transparent", border="dark grey", xaxt="n",

But these don't:
> st <- c(1:19)
> segments(st, pmax(data_frame), st, pmin(data_frame))

(no, I haven't tried to put in the median points yet)

I can plot them individually with
> segments(1, max(data_frame[,1]), 1, pmin(data_frame[,1]))
> points(1, median(fly_ash[,1]))

but that's a bit tedious. Is there a better way of vectorising these columns such that they will work with pmax? Is there something like a pmedian?

Hazel Jenkins

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. Received on Sun 27 Apr 2008 - 16:44:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Apr 2008 - 18:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive