[R] if else statement

Sebastian P. Luque spluque at gmail.com
Fri Jan 19 04:21:14 CET 2007


On Thu, 18 Jan 2007 19:02:49 -0800,
"H. Paul Benton" <hpbenton at scripps.edu> wrote:

> Hello,

>     I'm doing some scripting and I've noticed that R doesn't seem to
> have an
> if (cond){
>     do
> }ifelse (cond) {
>     do
> } else {
>     do
> }

> type block.


It's legal to join if else statements together:


if (cond) {
    do X
} else if (cond) {
    do Y
} else if (cond) {
    do Z
} else do W


-- 
Seb



More information about the R-help mailing list