Re: [R] apply over parallel lists and their elements

2010-09-14 Thread Liviu Andronic
On Tue, Sep 14, 2010 at 12:44 AM, David Winsemius dwinsem...@comcast.net wrote: The second argument to mean is trim. I am not sure what mean(1, 3) is supposed to do but what it return is 1. Thanks for the info. On this particular point I find the documentation confusing. In ?mapply : '‘mapply’

Re: [R] apply over parallel lists and their elements

2010-09-13 Thread Liviu Andronic
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,

Re: [R] apply over parallel lists and their elements

2010-09-13 Thread David Winsemius
On Sep 13, 2010, at 5:20 PM, Liviu Andronic wrote: 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

[R] apply over parallel lists and their elements

2010-09-12 Thread Sebastian Gibb
Hello, I have a list like the following: tree-list(); tree[[1]]$node-list(); tree[[2]]$node-list(); tree[[1]]$node$values - 1:10 tree[[2]]$node$values - 1:10 After building the list I have to generate the mean of all values elements with equal indices. Until now I use something like that:

Re: [R] apply over parallel lists and their elements

2010-09-12 Thread Liviu Andronic
On Sun, Sep 12, 2010 at 9:40 AM, Sebastian Gibb li...@sebastiangibb.de wrote: But I want to do a sapply over the values vectors. Try multivariate apply. For more on loops and the apply family check [1]. You might also want to check the plyr package and its documentation. Liviu [1]

Re: [R] apply over parallel lists and their elements

2010-09-12 Thread Sebastian Gibb
Hello, thanks for your answer. mapply fits to my needs. 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? mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values, ... tree[[k]]$node$values); Kind regards, Sebastian