Thanks for your advice!

I found another method to solve my problem (on page 20 of the manual =) ).
Here's my code

# Set n and m to whatever you want
n = 25
m = 10

# Build a random vector (here with exponential distribution) with lenght of
n*m
x = rexp(n*m,1)

# Set up a factor in order to group x into pieces each of size ten
y = factor( rep(1:n, each = m) )

# tapply will apply mean to each group..
result = tapply(x,y,mean)

--
View this message in context: 
http://r.789695.n4.nabble.com/calculating-the-mean-of-a-random-matrix-by-row-and-some-general-questions-tp3678964p3679186.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to