I am sure this si a simple problem but the solution is evading me.

I have a list of matrices all with the same number of columns but different
number of rows.  The first two columns label the row.  The labels are
allways the same for the same row numbers, just some matricies have more
rows.

For example using 3 column matrices...

> q.1 <- function(r){return(cbind(seq(0, 10, by=1)[1:r], seq(10, 30,
by=2)[1:r], runif(r)))}
> sapply(q, q.1)
[[1]]
     [,1] [,2]      [,3]
[1,]    0   10 0.5399220
[2,]    1   12 0.1551015
[3,]    2   14 0.9664470

[[2]]
     [,1] [,2]       [,3]
[1,]    0   10 0.09678172
[2,]    1   12 0.75177116
[3,]    2   14 0.59927159
[4,]    3   16 0.18472215

[[3]]
     [,1] [,2]      [,3]
[1,]    0   10 0.6343689
[2,]    1   12 0.8121039

Given such a list I would like to create a matrix:

0 10 mean(ThisCol for this row)
1 12 mean(ThisCol for this row)
2 14 mean(ThisCol for this row)
3 16 mean(ThisCol for this row)

I can loop using a for loop but I would like to use apply but I have no idea
how to get it to work.  If I could pass arguments by reference to a function
it would be easy but as far as I can tell there is only pass by value.


 cheers
Worik

	[[alternative HTML version deleted]]

