Hi there,
Just wondering if someone can help me with the correct syntax to use with for loops? I have split my original file by count, & wish to first of all assign new tables based on the splits. Then I just want to create a new variable. Please see code below. This code works outside of a loop so I am just trying to code so I don't have to repeat numerous times. Many thanks in advance, Bronagh A2 = split(A1,A1$count) for(i in 1:10){ trial[i] <- data.frame(A2$`i`) trial[i]$BLD[i] <- triali$BLD trial[i]$count <- triali$BLD <- NULL } [[alternative HTML version deleted]] ______________________________________________ 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.