Displaying 1 result from an estimated 1 matches for "cbi_totlist".
2011 Feb 09
2
nested ifelse problem
...I want to create a new column (fd$cbi_tot) that is an average of some of the other columns (chosen based on the conditions as indicated in the code below).
ifelse(is.na(fd$cbi_C) & is.na(fd$cbi_D) & is.na(fd$cbi_E) & is.na(fd$cbi_F) & is.na(fd$cbi_B1) & !is.na(fd$cbi_B2),
cbi_totlist <- cbind(fd$cbi_A, fd$cbi_B2),
ifelse(is.na(fd$cbi_C) & is.na(fd$cbi_D) & is.na(fd$cbi_E) & is.na(fd$cbi_F) & is.na(fd$cbi_B2) & !is.na(fd$cbi_B1),
cbi_totlist <- cbind(fd$cbi_A, fd$cbi_B1),
ifelse(is.na(fd$cbi_C) & is.na(fd$cbi_D) & is.na(fd$cbi_E) & is.na(fd$...