From suharto_anggono at yahoo.com  Wed Sep 14 17:15:35 2016
From: suharto_anggono at yahoo.com (Suharto Anggono Suharto Anggono)
Date: Wed, 14 Sep 2016 15:15:35 +0000 (UTC)
Subject: [Rd] R-intro: length of 'ifelse' result
References: <1598036366.967396.1473866135477.ref@mail.yahoo.com>
Message-ID: <1598036366.967396.1473866135477@mail.yahoo.com>

In "An Introduction to R" Version 3.3.1, in "9.2.1 Conditional execution: if statements", the last paragraph is the following:
There is a vectorized version of the if/else construct, the ifelse function. This has the form ifelse(condition, a, b) and returns a vector of the length of its longest argument, with elements a[i] if condition[i] is true, otherwise b[i].


In fact, ifelse(condition, a, b) returns a vector of the length of 'condition', even if 'a' or 'b' is longer.



[Rd] R-intro: length of 'ifelse' result
Suharto Anggono Suharto Anggono