Try: mxx = 2 mxy = 4 if (mxx > mxy) { print ("mxx reigns supreme") } else { print ("mxy reigns supreme") }
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Beck, Kenneth (STP) Sent: Tuesday, April 29, 2008 9: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 error. There is no example in the help file, and this is not covered in the Introduction to R, SimpleR or other tutorials I have looked into. mxx=max(cpx_list$nMV); mxy=max(trend_list$nMV); if (mxx>mxy) mxy=mxx else mxx=mxy Error: unexpected 'else' in "else" Why does this error message have the first 'else' in single quote and second in double?? ______________________________________________ R-help@r-project.org mailing list 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. ______________________________________________ R-help@r-project.org mailing list 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.