[R] using "by" and indicies

Jason Turner jasont at indigoindustrial.co.nz
Sun Mar 17 19:41:13 CET 2002


I sent this to the list last week, and haven't seen it pop up.  Either 
I deleted it when it did appear, or possibly it was destroyed as 
spam...?  If it did appear and I somehow missed it, appologies.

In a nutshell, can the function FUN supplied to by() deduce
what level of factor by() was on when FUN was called?  I've
been digging through the functions, and can't see where the
distinction is made so that get() with a suitable "where=x"
argument could help.

Cheers

Jason
----- Forwarded message from Jason Turner <jasont at indigoindustrial.co.nz> -----

...

I'm using by() to call pairs(), and would like to put the factor
level into the title.  A toy example would be something like:


> d1 <- data.frame(rnorm(100),rt(100,2),sin(1:100))
> levs <- as.factor(rep(1:5,20))
> levels(levs) <- c("low","med-lo","med","med-hi","high")
> by(d1,levs,pairs)

Is there an elegant way to get "low"..."high" in the main title for
each plot, without binding "levs" to the data sent to a custom plot 
function? 

...

-- 
Indigo Industrial Controls Ltd.
64-21-343-545
jasont at indigoindustrial.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list