How can I save the changes occurred in a data frame within a loop, after each iteration? By the following codes, I want to delete some rows from my data frame (df) which have equal value to 'v'. The codes works well, but the problem is finally, only the result of the last i value in the iterations affects the data frame!
for (i in 1:50){
v <- i+ 450
temp<- fn$sqldf("select count(V1) from df where V1='$v' ")
if (temp[1,] < 1000){
g <- temp[1,]
c <- v
print(paste("Topic number: ", c, "is less than 1000, with ", g, "records") )
new_df<- df[df$V1 != v,]
}
}