Hello On Sun, Sep 12, 2010 at 5:37 PM, Sebastian Gibb <li...@sebastiangibb.de> wrote: > Hello, > > thanks for your answer. > mapply fits to my needs. > One thing that seems strange is that if you use tree[[1]]$node$values <- 1:10 tree[[2]]$node$values <- 3:12
you still get > mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values) [1] 1 2 3 4 5 6 7 8 9 10 But I cannot understand what's wrong. > But I don't know how many items would "tree" have. I can't write them all by > hand. > How can I generate the arguments for mapply? > Unfortunately I cannot think of a solution. Perhaps reorganise your data, so that all relevant data points go into the same vector. For example, tree[[4]]<-list(); tree[[4]][['node']]<-list(); tree[[4]]$node$more[[1]] <- 1:10 tree[[4]]$node$more[[2]] <- 3:12 > mapply(mean, tree[[4]]$node$more) [1] 5.5 7.5 Also check maply and mlply to see if they can fit your needs. [1] Regards Liviu [1] http://had.co.nz/plyr/plyr-intro-090510.pdf > mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values, ... > tree[[k]]$node$values); > > Kind regards, > > Sebastian > > ______________________________________________ > 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. > -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail ______________________________________________ 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.