[R] newbie question: ROW average
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Mon May 29 13:38:03 CEST 2006
look at ?rowMeans; you can also use "apply(mat, 1, mean)" but
rowMeans() is better.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "A Ezhil" <ezhil02 at yahoo.com>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Monday, May 29, 2006 1:24 PM
Subject: [R] newbie question: ROW average
> Hi,
>
> I am new to R programming. I have a 992 x 74 matrix. I
> would like to form a new matrix by averging each 4
> rows
> from the original one. How can I use 'apply' instead
> of usual mean inside the nested for loop?
>
> Thanks in advance.
>
> regards,
> ezhil
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list