Re: [R] If(cond) statement

2008-05-01 Thread Greg Snow
l 29, 2008 11:22 AM > To: r-help@r-project.org > Subject: [R] If(cond) statement > > Why will this simple statement not work? I think I am > following the documentation for if(cond) statements, and I > have tried wrapping the cons.expr and alt.expr in {}, I get > the same err

Re: [R] If(cond) statement

2008-04-29 Thread Johannes Hüsing
Beck, Kenneth (STP) <[EMAIL PROTECTED]> [Tue, Apr 29, 2008 at 07:21:40PM CEST]: > mxx=max(cpx_list$nMV); > mxy=max(trend_list$nMV); > if (mxx>mxy) > mxy=mxx > else > mxx=mxy > Can't this be replaced by mxx <- max(c(cpx_list$nMV, trend_list$nMV)) mxy <- mxx ? -- Johannes Hüsing

Re: [R] If(cond) statement

2008-04-29 Thread Hutchinson,David [PYR]
p@r-project.org Subject: [R] If(cond) statement Why will this simple statement not work? I think I am following the documentation for if(cond) statements, and I have tried wrapping the cons.expr and alt.expr in {}, I get the same error. There is no example in the help file, and this is not covered i

Re: [R] If(cond) statement

2008-04-29 Thread Erik Iverson
Kenneth - See ?if in the Details section. Specifically this part (at least in R 2.7), "In particular, you should not have a newline between '}' and 'else' to avoid a syntax error in entering a 'if ... else' construct at the keyboard or via 'source'." The R interpreter can't 'see ahead' th

Re: [R] If(cond) statement

2008-04-29 Thread Chuck Cleland
On 4/29/2008 1:21 PM, Beck, Kenneth (STP) wrote: Why will this simple statement not work? I think I am following the documentation for if(cond) statements, and I have tried wrapping the cons.expr and alt.expr in {}, I get the same error. There is no example in the help file, and this is not cover

[R] If(cond) statement

2008-04-29 Thread Beck, Kenneth (STP)
Why will this simple statement not work? I think I am following the documentation for if(cond) statements, and I have tried wrapping the cons.expr and alt.expr in {}, I get the same error. There is no example in the help file, and this is not covered in the Introduction to R, SimpleR or other tutor