[R] mean

Douglas Bates bates at stat.wisc.edu
Fri Jun 6 21:14:49 CEST 2008


See also

?rowMeans


On Fri, Jun 6, 2008 at 1:56 PM,  <ctu at bigred.unl.edu> wrote:
>> 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.
>>
>
> ______________________________________________
> 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