On 17-04-2013, at 14:39, Christofer Bogaso wrote:
> Hello again,
>
> Let say I have a matrix:
>
> Mat <- matrix(1:12, 4, 3)
>
> And a vector:
>
> Vec <- 5:8
>
> Now I want to do following:
>
> Each element of row-i in 'Mat' will be divided by i-th element of Vec
>
> Is there any direct wa
0.200 1 1.80
#[2,] 0.333 1 1.67
#[3,] 0.4285714 1 1.571429
#[4,] 0.500 1 1.50
A.K.
- Original Message -
From: Christofer Bogaso
To: r-help
Cc:
Sent: Wednesday, April 17, 2013 8:39 AM
Subject: [R] On matrix calculation
Hello again,
Let say I hav
Hello again,
Let say I have a matrix:
Mat <- matrix(1:12, 4, 3)
And a vector:
Vec <- 5:8
Now I want to do following:
Each element of row-i in 'Mat' will be divided by i-th element of Vec
Is there any direct way to doing that?
Thanks for your help
___
3 matches
Mail list logo