1. > x<-1;
> if(x>0) { x<--x;}
>x
2. >x<-6;
> if(x>0) { x<-1;}
> else x<--1;
> x
3.> x<-1;
> y <- if(x>0) 1 else -1;
> y
4. x<--1;
if (x>0)
{ cat("x is positive\n");}
else if(x<0)
{ cat("x is negative\n");}
else stop("x = 0\n");
5. x<-1;
y <- ifelse(x>0, 2,3);