Vlatka Matkovic Puljic
2010-Apr-22 15:07 UTC
[R] compare variables and take largest value?
Hi! I have v1, v2 and v3 (data in v. ranges 1 to 4) v1 [1] 1 1 1 1 NaN 1 1 4 1 1 3 v2 [1] 1 1 1 1 1 1 1 1 1 1 1 v3 [1] 1 1 1 1 1 1 1 1 1 1 1 I want R to compare entries in v1,v2,v3 and in v4 to put largest value (NA=0). For example. first line v4 would be 1, but last line v4 would be 3. What function should I use? -- ************************** Vlatka Matkovic Puljic 095/8618 171 [[alternative HTML version deleted]]
On 22/04/2010 11:07 AM, Vlatka Matkovic Puljic wrote:> Hi! > > I have v1, v2 and v3 (data in v. ranges 1 to 4) > > v1 > [1] 1 1 1 1 NaN 1 1 4 1 1 3 > v2 > [1] 1 1 1 1 1 1 1 1 1 1 1 > v3 > [1] 1 1 1 1 1 1 1 1 1 1 1 > > I want R to compare entries in v1,v2,v3 and in v4 to put largest value > (NA=0). > For example. first line v4 would be 1, but last line v4 would be 3. > > What function should I use? > >pmax. Duncan Murdoch