“Within is working or not in loop” for(j in 1:10){ card_bal <- as.numeric(segment_cuts$card_bal[[j]]) insurance_bal <- as.numeric(segment_cuts$insurance_bal[[j]]) data$segment_rank <- within(data,segment_rank[ data$Total_Balance >= total_bal & data$Insurance_Balance >= insurance_bal] <- “class1” )}
“I am not sure about why within is working inside for loop or not. I did not get any error but when ran this for j=1 then it will create duplicate columns in data. ----- Bharat Warule Cypress Analytica , Pune -- View this message in context: http://r.789695.n4.nabble.com/Within-is-working-or-not-in-loop-tp4544965p4544965.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.