[R] mean

ctu at bigred.unl.edu ctu at bigred.unl.edu
Fri Jun 6 20:56:39 CEST 2008


> TABLE<-matrix(data=c(12,13,14,15,24,10),byrow=T,nrow=2,ncol=3)
> TABLE
      [,1] [,2] [,3]
[1,]   12   13   14
[2,]   15   24   10
> apply(TABLE,1,mean)
[1] 13.00000 16.33333

Chunhao


Quoting Marco Chiapello <marco.chiapello at unito.it>:

> Hi,
> I have a simple question. If I have a table and I want to have the mean
> for each row, how can I do?!
> Es:
> 	c1	c2	c3	mean
> 1	12	13	14	??
> 2	15	24	10	??
> ...
>
> Thanks,
> Marco
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list