?aggregate will do it.
x <- data.frame( height= c(50, 174, 145, 200, 210, 140, 175),
age_group=c(1,2,2,1,1,2,1),
ville= c(1,2,3,1,2,3,1))
aggregate(x$height,list(x$age_group, x$ville), mean)
or have a look at the plyr or datatable packages.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: skhan30 at nshs.edu
> Sent: Fri, 16 Nov 2012 15:58:17 -0500
> To: r-help at r-project.org
> Subject: [R] Calculateing means
>
>
> Dear List,
>
> I have a data matrix with 570 columns containing 95 (samples) with 6
> replicates each.
> How can I calculate the mean of the replicates for 95 samples?
> Thank you.
>
>
> The information contained in this electronic e-mail transmission and any
> attachments are intended only for the use of the individual or entity to
> whom or to which it is addressed, and may contain information that is
> privileged, confidential and exempt from disclosure under applicable law.
> If the reader of this communication is not the intended recipient, or the
> employee or agent responsible for delivering this communication to the
> intended recipient, you are hereby notified that any dissemination,
> distribution, copying or disclosure of this communication and any
> attachment is strictly prohibited. If you have received this transmission
> in error, please notify the sender immediately by telephone and
> electronic mail, and delete the original communication and any attachment
> from any computer, server or other electronic recording or storage device
> or medium. Receipt by anyone other than the intended recipient is not a
> waiver of any attorney-client, physician-patient or other priv!
> ilege.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
____________________________________________________________
Send any screenshot to your friends in seconds...
Works in all emails, instant messengers, blogs, forums and social networks.
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if2 for FREE