Dear Murali,
Here is one way:
set.seed(123)
a <- matrix(abs(rnorm(100)), 10)
b <- rnorm(10)
apply(a,2,function(x) ifelse(b>quantile(b,probs=0.75),-x,x))
HTH,
Jorge
On Wed, Nov 5, 2008 at 11:30 AM, <[EMAIL PROTECTED]> wrote:
> Folks,
>
> I have a matrix:
>
> set.seed(123)
> a <- matrix(rn
you almost have it, e.g., check the following:
set.seed(123)
a <- matrix(rnorm(100), 10)
b <- rnorm(10)
ind <- b > quantile(b, 0.75)
a[ind, ] <- -a[ind, ]
a
I hope it helps.
Best,
Dimitris
[EMAIL PROTECTED] wrote:
Folks,
I have a matrix:
set.seed(123)
a <- matrix(rnorm(100), 10)
And a v
2 matches
Mail list logo