lalitha viswanath
2006-Jul-11 17:41 UTC
[R] Query about getting averages across a certain parameter in a table
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
jim holtman
2006-Jul-11 23:17 UTC
[R] Query about getting averages across a certain parameter in a table
> 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]]