ifelse return a value with the same length that logical test.
You need if () {} else {}
if (y == 5) rep(2, 4) else NA
On Thu, Sep 16, 2010 at 3:58 PM, deven hamilton wrote:
> I have come across simple problem in R and I was hoping
>
> someone out there could help me out. Here is the problem: I
I have come across simple problem in R and I was hoping
someone out there could help me out. Here is the problem: I am trying to
set up and rep statement with a conditional statement using ifelse. Here is
simple example.
> y=5
> o<-ifelse(y==5,rep(2,4),NA)
> o
> [1] 2
>
> If I check
2 matches
Mail list logo