Skip to content
Prev 138832 / 398506 Next

Passing function to tapply as a string

Hi,

Was wondering if it is possible to pass function name as a parameter, smth
along this line

param.to.pass<-c(1,'max','h')

dd<-function(dfd, param=param.to.pass,...){
  ttime.int <- format(ttime,fmt)
  data.frame(
     param[3] = tapply(dfd[,param[1]],ttime.int,param[3]),
         ...)
   }


I know there is a as.formula expression but not quite sure if there is some
way to accomplish what i need.
Thanks