Re: [R] Scaling a column in groups

2007-11-19 Thread Greg Snow
t; To: r-help@r-project.org > Subject: [R] Scaling a column in groups > > > > Hello R people > > I have a column of numeric values that are grouped in blocks > of 25 and to be centered and scaled within each block. (That > is subtract the mean and divide by the standa

Re: [R] Scaling a column in groups

2007-11-16 Thread Gabor Grothendieck
Try this: c(apply(matrix(testdata, 25), 2, scale)) On Nov 16, 2007 9:20 AM, john seers (IFR) <[EMAIL PROTECTED]> wrote: > > Hello R people > > I have a column of numeric values that are grouped in blocks of 25 and > to be centered and scaled within each block. (That is subtract the mean > and div

[R] Scaling a column in groups

2007-11-16 Thread john seers (IFR)
Hello R people I have a column of numeric values that are grouped in blocks of 25 and to be centered and scaled within each block. (That is subtract the mean and divide by the standard deviation.) Is there a neater way to do this? i.e not using a loop? Example looped code: testdata<-1:100 cs

Re: [R] Scaling a column in groups

2007-11-16 Thread john seers (IFR)
Ah, that is neat. Thanks. JS -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: 16 November 2007 15:12 To: john seers (IFR) Cc: r-help@r-project.org Subject: Re: [R] Scaling a column in groups Try this: c(apply(matrix(testdata, 25), 2, scale)) On Nov 16