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 <popophobia@gmail.com> wrote:

> 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). column
> 1
> and 2 are two different samples need to be compared.
>
> I hope I made myself clear enough. thanks for any help
>
> UCLA Neurology Research
>
> --
> Regards,
> Anh Tran
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

