[R] mean

Chuck Cleland ccleland at optonline.net
Fri Jun 6 21:00:57 CEST 2008


On 6/6/2008 11:43 AM, Marco Chiapello wrote:
> 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

VADeaths
       Rural Male Rural Female Urban Male Urban Female
50-54       11.7          8.7       15.4          8.4
55-59       18.1         11.7       24.3         13.6
60-64       26.9         20.3       37.0         19.3
65-69       41.0         30.9       54.6         35.1
70-74       66.0         54.3       71.1         50.0

rowMeans(VADeaths)
  50-54  55-59  60-64  65-69  70-74
11.050 16.925 25.875 40.400 60.350

   You could have found rowMeans() with the following:

RSiteSearch("row means", restrict="functions")

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

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list