Re: [R] How to divide each column with its own value

2012-09-16 Thread Jha, Ashutosh Kumar
Dear Berend,   No need to devide what all you need a indentity matrix with same dimesion.   Following is one way to achieve this.     mat Hi, > > I have a matrix as below: > > mat= >     [,1]  [,2]  [,3] > [1,]    1    4    7 > [2,]    2    5    8 > [3,]

Re: [R] How to divide each column with its own value

2012-09-16 Thread Daniel Malter
It's not quite clear what you want to do. Is it just this? a<-c(1,2,3,4) dim(a)<-c(2,2) a/a This gives the element by element ratio. HTH, Daniel shukor wrote > > Hi, > > I have a matrix as below: > > mat= > [,1] [,2] [,3] > [1,]147 > [2,]258 > [3,]36

Re: [R] How to divide each column with its own value

2012-09-16 Thread Berend Hasselman
On 17-09-2012, at 07:31, Jha, Ashutosh Kumar wrote: > Dear Berend, > > No need to devide what all you need a indentity matrix with same dimesion. > Following is one way to achieve this. > > mat<-matrix(1,ncol=ncol(mat),nrow=nrow(mat)). That is not an identity matrix. It is a matrix with

Re: [R] How to divide each column with its own value

2012-09-16 Thread Berend Hasselman
On 17-09-2012, at 06:50, s.s.m. fauzi wrote: > Hi, > > I have a matrix as below: > > mat= > [,1] [,2] [,3] > [1,]147 > [2,]258 > [3,]369 > > What I want to do is, I would like to divide each column with its own > value, in order to get value 1. > Is th

[R] How to divide each column with its own value

2012-09-16 Thread s.s.m. fauzi
Hi, I have a matrix as below: mat= [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 What I want to do is, I would like to divide each column with its own value, in order to get value 1. Is there any simple script for that? [[alternative HTML version dele