Hello there

I have a list, Y, and each component of that list is a real-valued function
(that is, Y[[i]](u) returns a number).

I was wishing to build the mean function and the first thing I thought of
was

Ybar<-function(u){
   mean(Y[[1:n]](u))
}

but obviously this doesn't work, since Y[[1:n]] is not allowed at all.

Any elegant suggestions? I really would like to avoid something like

Ybar<-function(u){
   for (i in 1:n){
      Ybar<-Ybar + Ybar[[i]](u)
   }
   Ybar<-1/n*Ybar
}

Thanks in advance!

Best regards,

Eduardo Horta

        [[alternative HTML version deleted]]

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

Reply via email to