[R] ifelse when test is shorter than yes/no

About this list Date view Thread view Subject view Author view Attachment view

From: Vadim Ogranovich (vograno@evafunds.com)
Date: Fri 21 May 2004 - 03:49:25 EST


Message-id: <C698D707214E6F4AB39AB7096C3DE5A54B3313@phost015.EVAFUNDS.intermedia.net>

Hi,
 
It turns out that the 'test' vector in ifelse(test, yes, no) is not
recycled if it is shorter than the other arguments, e.g.
 
> ifelse(TRUE, seq(10), -seq(10))
[1] 1

 
Is there any particular reason it is not recycled? If there is one
indeed a warning message might be in order when someone calls ifelse
with a shorter 'test'.
 
This is R1.8.1 on RH-7.3
 
Thanks,
Vadim

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST