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

Berend Hasselman bhh at xs4all.nl
Mon Sep 17 07:28:42 CEST 2012


On 17-09-2012, at 06:50, s.s.m. fauzi wrote:

> Hi,
> 
> I have a matrix as below:
> 
> mat=
>     [,1]  [,2]  [,3]
> [1,]    1    4    7
> [2,]    2    5    8
> [3,]    3    6    9
> 
> 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?

mat/mat

Berend




More information about the R-help mailing list