Sorry for the simple question but I can't think of a good way to take functions elements of a list of data frames. I am sure there is something within the plyr/reshape2 packages but I just can't think of it.
For example I have a list A as follows:
>A
[[1]]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 1 1 1 1 1 1 1 1 1 1
[2,] 1 1 1 1 1 1 1 1 1 1
[3,] 1 1 1 1 1 1 1 1 1 1
[4,] 1 1 1 1 1 1 1 1 1 1
[5,] 1 1 1 1 1 1 1 1 1 1
[[2]]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 2 2 2 2 2 2 2 2 2 2
[2,] 2 2 2 2 2 2 2 2 2 2
[3,] 2 2 2 2 2 2 2 2 2 2
[4,] 2 2 2 2 2 2 2 2 2 2
[5,] 2 2 2 2 2 2 2 2 2 2
Say I want to take the mean across the corresponding elements of the matrices in the list. One way to do this would be
Reduce("+",A)/length(A)
I can't seem to feed Reduce() more complex functions and assume there is a better way in general.
Reduce.meanaccepts only one R object and that's the reason it fails. i don't think there is a generic approach, but for a class of functions, it would be possible to define a simple wrapper that makes it operate on 2 objects at a time and can be passed toReduce. it would be useful if you could post what function you have in minddo.call()approach.