while loop R script