well, not that simple. My original condition and changes are more complicated than I post in r-help for simplicity purposes . Original condition is something like :
if ( a > 0 & ( b[1] > b[2] ) | c == TRUE ) and I might change it to if ( a == 0 & ( b[1] < b[2] ) & d > 10 ) then I need to have a bunch of functions and I will forget which function I used. -----Original Message----- From: "Rainer M Krug" [rai...@krugs.de] Date: 06/02/2016 09:08 AM To: "ce" <zadi...@excite.com> CC: "Jeff Newmiller" <jdnew...@dcn.davis.ca.us>, r-help@r-project.org Subject: Re: Making an if condition variable ? "ce" <zadi...@excite.com> writes: > Thank you all for wisdom :) > Problem is that I change the condition often and then I forget it. I > wanted to put it at the beginning of the program with the other > parameters so I wouldn't miss it. In this case - why not use a function instead of the condition? cond <- function(x){x>0} and than if (cond(4)) {...} might be the easiest in this case? or, more flexible, cond <- function(...){x>0} if (cond(x=3)) {...} Cheers, Rainer > > ce > > > -----Original Message----- > From: "Rainer M Krug" [rai...@krugs.de] > Date: 06/02/2016 04:00 AM > To: "Jeff Newmiller" <jdnew...@dcn.davis.ca.us> > CC: r-help@r-project.org > Subject: Re: Making an if condition variable ? > > Jeff Newmiller <jdnew...@dcn.davis.ca.us> writes: > >> Beware of getting too "meta" in your programming... it is rarely worth >> it. Just write the code and move on with life. That is the beauty of a >> scripting language. > > +1 > > I think this a very common pitfall (I know it from own experience...) > and I would say a candidate for a fortune? > > Rainer -- Rainer M. Krug email: Rainer<at>krugs<dot>de PGP: 0x0F52F982 ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.