Hi,
I think you could also use this way (via array, see
http://r.789695.n4.nabble.com/apply-over-list-of-data-frames-td3057968.html)
b <- list()
b[[1]] = matrix(1:4, 2, 2)
b[[2]] = matrix(10:13, 2, 2)
b[[3]] = matrix(20:23, 2, 2)
b.a <- array(unlist(b), dim=c(2, 2, 3))
(b.mean <- apply(X = b.
Hi Hui,
Ssee ?Reduce for more details. You might try something along the lines of
> mymean <- function(x) Reduce("+", x)/length(x)
> add(b)
[,1] [,2]
[1,] 10.3 12.3
[2,] 11.3 13.3
HTH,
Jorge
On Thu, Mar 24, 2011 at 11:07 AM, Hui Du <> wrote:
> Hi All,
>
>
Sorry, the above should have been
> mymean <- function(x) Reduce("+", x)/length(x)
> mymean(b)
[,1] [,2]
[1,] 10.3 12.3
[2,] 11.3 13.3
Apologies for the noise.
Best,
Jorge
On Thu, Mar 24, 2011 at 3:54 PM, Jorge Ivan Velez <> wrote:
> Hi Hui,
>
> Ssee ?Reduce for m
Are you taking the same online course as Barth Riley, who posed a very
similar question only this morning?
On Mar 24, 2011, at 11:07 AM, Hui Du wrote:
Hi All,
Suppose I have data like
b[[1]] = matrix(1:4, 2, 2)
b[[2]] = matrix(10:13, 2, 2)
b[[3]] = matrix(20:23, 2, 2)
[[1]]
Hi All,
Suppose I have data like
[[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
Hi All,
Suppose I have data like
b[[1]] = matrix(1:4, 2, 2)
b[[2]] = matrix(10:13, 2, 2)
b[[3]] = matrix(20:23, 2, 2)
[[1]]
[,1] [,2]
[1,]13
[2,]24
[[2]]
[,1] [,2]
[1,] 10 12
[2,] 11 13
[[3]]
[,1] [,2]
[1,] 20 22
[2,] 21 23
6 matches
Mail list logo