Skip to content
Back to formatted view

Raw Message

Message-ID: <loom.20110406T004736-63@post.gmane.org>
Date: 2011-04-05T22:48:50Z
From: Ben Bolker
Subject: IFELSE function XXXX

William Dunlap <wdunlap <at> tibco.com> 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