I am having some trouble with a nested ifelse statement. I have the following code written. It should force a TRUE or FALSE but I am getting some NAs. Can you help me figure out where its broken?
data looks something like...
Name<- c(Jon,Jim,Jake,Jess,Jill,Jay,Jason)
LinkFlag<- c( NA, NA, NA, NA, NA, NA, NA)
1<- c(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
2<- c(2.5, NA, NA, NA, NA, 3.0, NA)
spread_wide<-c(Name,LinkFlag,1,2)
The intended Result is that there are no NAs
sw_RESULTS$EvalSeq1to2<-ifelse(spread_wide$`1` == 99, TRUE,
ifelse(spread_wide$`1` == (spread_wide$`2`-1), TRUE,
ifelse(is.na(spread_wide$`2`),TRUE,
ifelse(spread_wide$`2` ==99,TRUE,
ifelse(spread_wide$`1`== (spread_wide$`2`-0.5),TRUE,
ifelse(spread_wide$`1` == spread_wide$`2`, TRUE,
ifelse(spread_wide$`LinkFlag`=='FlagforSkip", TRUE,
FALSE)))))))
Aucun commentaire:
Enregistrer un commentaire