[R] accessing current factor in tapply

Bernie McConnell bm8 at st-andrews.ac.uk
Thu Apr 17 19:13:16 CEST 2003


G'Day,

I want to access in a function called from tapply the current factor.  In 
my example below, all I want to do is to write the current factor on each 
histogram.  Needless to say my example does not work. I would be grateful 
for pointers in the right direction.

Many thanks
Bernie McConnell
Sea Mammal Reserach Unit


cc <- 1:10
ff <- rep(c("a","b"),5)

pp<- function(x,f) {
   hist(x, main=as.character(f))
   }


tapply(aa, ff, pp, f=ff)



More information about the R-help mailing list