Sorry guys if this is a noob question. I need help on how to loop over my dataframe.Here is a sample data.
a <- c(10:29); b <- c(40:59); e <- rep(1,
You don't need a loop. You have nearly all you need:
test[test$a > 15 & test$a < 20, "e"] <- 2