Re: [R] IFELSE function XXXX

From: Ben Bolker <>
Date: Tue, 05 Apr 2011 22:48:50 +0000

William Dunlap <wdunlap <at>> writes:

> Avoid assignments in arguments to function calls, especially
> multiple assignments to the same object, except when you know
> what you are doing and want to write obscure code.
> Change the above line to
> data3$input1 <- ifelse(data3$res1==1, data3$input1+10, data3input1)

  data3 <- transform(data3,input1=ifelse(res==1,input1+10,input1))

 might be even clearer mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Apr 2011 - 22:54:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 23:40:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive