Re: [R] Query about getting averages across a certain parameter in a table

From: jim holtman <jholtman_at_gmail.com>
Date: Wed 12 Jul 2006 - 09:17:54 EST

> x <- "

+ cluster_ac  clockrate age class
+ 7337         0.19       0.001  alpha_proteins
+ 7888         0.21       0.78   beta_proteins
+ 7337         0.39       0.001  alpha_proteins
+ 7888         0.41       0.78   beta_proteins
+ 7337         0.59       0.001  alpha_proteins
+ 7888         0.61       0.78   beta_proteins
+ 7337         0.97       0.001  alpha_proteins
+ 7888         0.81       0.78   beta_proteins
+ 7337         0.99       0.001  alpha_proteins
+ 7888         0.1       0.78   beta_proteins
+ "

> df <- read.table(textConnection(x), header=TRUE)
> tapply(df$clockrate, df$class, mean)

alpha_proteins beta_proteins

         0.626 0.428
>

On 7/11/06, lalitha viswanath <lalithaviswanath@yahoo.com> wrote:
>
> Hi
> I have a table that goes
> data
>
> cluster_ac clockrate age class
> 7337 0.9 0.001 alpha_proteins
> 7888 0.1 0.78 beta proteins
>
> etc
>
> The class column can have 7-8 different unique values
> While the clockrate and age columns are floats varying
> from 0 to 1.
>
> I wish to get the average clockrate across each of the
> classes for this data.
>
> I would appreciate your help regarding the aboe.
>
> Thanks
> Lalitha
>
> ______________________________________________
> R-help@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
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@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
Received on Wed Jul 12 09:22:42 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 10:17:19 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.