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,20);
test <- data.frame(a,b,e)
I need to manipulate column "e" using the following criteria for values in column "a"
for all values of
"a" <= 15, "e" = 1,
"a" > 15 & < 20, "e" = 2
"a" > 20 & < 25, "e" = 3
"a" > 25 & < 30, "e" = 4 and so on to look like this
result <- cbind(a,b,rep(1:4, each=5))
My actual data frame is over 100k long. Would be great if you could sort me out here.