Re: [R] How to replace all non-maximum values in a row with 0

2010-04-30 Thread burgundy
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

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-30 Thread burgundy
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

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread Dennis Murphy
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

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread William Dunlap
> -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

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread ONKELINX, Thierry
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

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread Owe Jessen
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

[R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread 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 1 0 0 0 0 0 0 0 Thanks! -- View