Thanks for advice, sorted now!
From: Owe Jessen-2 [via R]
Sent: Fri, 9 April, 2010 18:39:53
Subject: Re: How to replace all non-maximum values in a row with 0
Am 09.04.2010 10:04, schrieb burgundy:
> Hi,
>
> I would like to replace all the max values per
Thanks for advice, sorted now!
From: Dennis Murphy [via R]
Sent: Sat, 10 April, 2010 2:18:33
Subject: Re: How to replace all non-maximum values in a row with 0
Hi:
This isn't much shorter than the previous solution, but here's another take,
operating row-w
Hi:
This isn't much shorter than the previous solution, but here's another take,
operating row-wise.
A <- matrix (c(2, 3, 0, 0, 200, 30, 0, 0, 2, 50, 0, 0, 3, 0, 0,
0, 0, 8, 8, 0), nrow = 4, byrow=T)
# Write a vector function to apply to each row: begin by i
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of ONKELINX, Thierry
> Sent: Friday, April 09, 2010 2:25 AM
> To: jes...@econinfo.de; r-help@r-project.org
> Subject: Re: [R] How to replace all non-maximum valu
k bericht-
> Van: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] Namens Owe Jessen
> Verzonden: vrijdag 9 april 2010 11:08
> Aan: r-help@r-project.org
> Onderwerp: Re: [R] How to replace all non-maximum values in a
> row with 0
>
> Am 09.04.2010 10:04, sc
Am 09.04.2010 10:04, schrieb burgundy:
Hi,
I would like to replace all the max values per row with "1" and all other
values with "0". If there are two max values, then "0" for both. Example:
from:
2 3 0 0 200
30 0 0 2 50
0 0 3 0 0
0 0 8 8 0
to:
0 0 0 0 1
0 0 0 0 1
0 0
Hi,
I would like to replace all the max values per row with "1" and all other
values with "0". If there are two max values, then "0" for both. Example:
from:
2 3 0 0 200
30 0 0 2 50
0 0 3 0 0
0 0 8 8 0
to:
0 0 0 0 1
0 0 0 0 1
0 0 1 0 0
0 0 0 0 0
Thanks!
--
View
7 matches
Mail list logo