Re: [R] Centering data frame by factor

2011-07-19 Thread David Winsemius
On Jul 19, 2011, at 11:58 AM, William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Daniel Malter Sent: Tuesday, July 19, 2011 1:51 AM To: r-help@r-project.org Subject: Re: [R] Centering data frame by factor

Re: [R] Centering data frame by factor

2011-07-19 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Daniel Malter > Sent: Tuesday, July 19, 2011 1:51 AM > To: r-help@r-project.org > Subject: Re: [R] Centering data frame by factor > > > P

Re: [R] Centering data frame by factor

2011-07-19 Thread David Winsemius
On Jul 19, 2011, at 4:50 AM, Daniel Malter wrote: P1-tapply(P1,Experiment,mean)[Experiment] Another way would be with ave(), but I discovered that it does not accept subsidiary arguments and does not issue warnings either, so this works: > with(dfrm, ave(P1, Experiment, FUN=function(x

Re: [R] Centering data frame by factor

2011-07-19 Thread ronny
Perfect! Made my day! -- View this message in context: http://r.789695.n4.nabble.com/Centering-data-frame-by-factor-tp3677609p3677665.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] Centering data frame by factor

2011-07-19 Thread Daniel Malter
P1-tapply(P1,Experiment,mean)[Experiment] HTH, Daniel ronny wrote: > > Hi, > > I would like to center P1 and P2 of the following data frame by the factor > "Experiment", i.e. substruct from each value the average of its > experiment, and keep the original data structure, i.e. the experiment a