[R] Using a data frame to create a legend

Tom Snowden tom.snowden at gmail.com
Thu Jan 17 11:44:00 CET 2008

>If I understand your question:
>x <- rnorm(100)
>legend("topright", capture.output(t(t(summary(x)))))

Thank you for your help, but I'm afraid that is not what I meant.

As an example of what i am trying to say, imagine I had grouped a whole
bunch of people into 4 age ranges and then plotted time (0-24h) against
their heart rates (can't think of a better example). So each of the four age
ranges are represented by one line in the plot (i.e. the plot has 4 lines).
But say I had also calculated the area under each curve, the average of each
curve and the expected time at which their heart rate was lowest for each
curve, and that I wanted to express this information on the graph in a table
that lined up with the legend. So the legend now has a column for age range,
AUC, mean, E(Tmin) and finally a column depicting what each age range is
represented by on the graph (the col and pch). Unfortunately, even though I
have this working in SPlus, I haven't achieved quite the same result in R.
Any help would be appreciated.

View this message in context: http://www.nabble.com/Using-a-data-frame-to-create-a-legend-tp14880656p14916274.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list