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

2004-05-20 Thread Vadim Ogranovich
I did x <- matrix(ifelse(test, yes, no), nrow(yes), ncol(yes)) priding myself for doing it the "whole object way" ... and 'test' did not recycle (in full accordance with the help page) w/o a warning. Thanks, Vadim > -Original Message- > From: Liaw, Andy [ma

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

2004-05-20 Thread Liaw, Andy
> From: Vadim Ogranovich > > 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

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

2004-05-20 Thread Vadim Ogranovich
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