[R] ifelse help

Jeff r at jp.pair.com
Wed Jul 11 03:29:47 CEST 2012


At 07:41 PM 7/10/2012, you wrote:

>Seems to work for me:
>
> > x <- data.frame(old1 = sample(c(1,2,8), 10, TRUE), old2 = 1:10)
> > x$new <- ifelse(x$old1 == 8, 1, x$old2)
> > x


Thanks Jim and Dan. The problem ended up with a missing values issue 
that threw me off. When your post confirmed that my code was right 
all along, I finally figured out the real problem.

Jeff



More information about the R-help mailing list