Re: [R] Rescaling a column in a matrix based on a certain rows

2008-05-09 Thread Jorge Ivan Velez
Hi Anh, If I undestarstand: # Your matrix set.seed(123) mat<-matrix(cbind(rnorm(20),rnorm(20)), ncol = 2) # Scale (mat-apply(mat[1:5,],2,mean))/apply(mat[1:5,],2,sd) HTH, Jorge On Fri, May 9, 2008 at 3:51 PM, Anh Tran <[EMAIL PROTECTED]> wrote: > Hi, > Let say I have this matrix: > > > mat

[R] Rescaling a column in a matrix based on a certain rows

2008-05-09 Thread Anh Tran
Hi, Let say I have this matrix: > mat<-matrix(cbind(rnorm(20),rnorm(20)), ncol = 2) And I want to rescale values of column [,1] and [,2] using values from row 1 to 5, such that the values of row 1:5 should be rescale to the same amplitude (kinda like take the z-score of population from row 1:5).