I have 2 columns I need to run a few conditions on in order to classify samples as a status. I created an empty status column. Then ran the few conditions of the two columns (pp & ff) to try insert the corresponding value in the new column.
When I run this I get no error but only the first line works:
df$status[which(df$ff >7 & df$pp >9)] <- "type_a"
The type_a values are placed correctly in the status column but all other rows remain as NA. I have 2 or 3 odd NA values sparsely in a few rows of the two columns, but that is it. I don't think that would stop it from working?
This is what I'm currently working with:
#Adding a column called status
df$status <- NA
df$status[which(df$ff >7 & df$pp >9)] <- "type_a"
df$status[which(df$ff <4 & df$pp <4)] <- "type_b"
df$status[which(df$ff <=4 & df$ff >=7 & df$pp >=8.5 & df$pp <=9)] <- "type_c"