Re: [R] Conditions in R (Help Post)

2019-10-23 Thread Yeasmin Alea
& Y < X ~ 'phase=5', > TRUE ~ 'unknown' > ) > ) > > > input > # A tibble: 2 x 6 >YEAR DAY X Y Sig phase > > 1 1981 9 -0.213 1.08 1.1 phase=8 > 2 198110 0.065 1.05 1.05 phase=6

[R] Conditions in R (Help Post)

2019-10-22 Thread Yeasmin Alea
Hello Team I would like to add a new column (for example-Phase) from the below data set based on the conditions YEAR DAY X Y Sig 1 1981 9 -0.213 1.08 1.10 2 198110 0.065 1.05 1.05 *Conditions* D$Phase=sapply(D,function(a,b) { a <-D$X b<-D$Y if (a<0 &