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
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
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
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
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
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
6 matches
Mail list logo