Re: [R] Using a data frame to create a legend

2008-01-17 Thread Tom Snowden


If I understand your question:

x - rnorm(100)
plot(x)
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.

__
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.


Re: [R] Using a data frame to create a legend

2008-01-16 Thread Henrique Dallazuanna
If I understand your question:

x - rnorm(100)
plot(x)
legend(topright, capture.output(t(t(summary(x)


On 16/01/2008, Tom Snowden [EMAIL PROTECTED] wrote:

 Hi,

 I am currently in the process of translating a large script from S-Plus over
 to R. It's going well so far and all the high level stuff is working fine,
 but as they say 'the devil is in the details' and my low level stuff is
 struggling. Specifically, I have enountered a problem translating from key()
 to legend(); in splus I was able to create a tables of statistics (AUCs and
 averages that I had calculated earlier in the script) that lined up with the
 key using bits of script as simple as:

 key(   text=list(temp.cd),
 text=list(temp.a),
 text=list(temp.b),
 text=list(temp.c),
 text=list(temp.d),
 text=list(temp.lab),
 lines=list(type=c(n, rep(o, length(temp.cd))), col=temp.COL,
 pch=temp.PCH),
 border=F, corner=c(1, 1), align=T, cex=0.9)

 It is not obvious to me how I would achieve something similar in R and any
 help would be greatly appreciated.

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

 __
 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.



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
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.