[R] Running Loops

jfrei006 jfrei006 at fiu.edu
Wed Sep 11 16:49:29 CEST 2013


I have a data set called yall with 5000 rows, I want to randomly sub sample
100 rows 100 times.
This is what I have so far:

yall<-read.csv("Z:\\SOFTEL\\North Key Largo
project\\Canopy_Height\\random_age_strat\\Young\\Abv2ft_young.csv")

*yall1 <- yall[sample(1:nrow(yall), 100, replace=FALSE),]

write.csv(yall1, file = "yall1.csv")*

I want to run a loop of the bold script above 100 times, but I want to be
able to change the name of the sub sample and name of the csv file each
time. They should be named yall1, yall2,yall3...etc until 100.



--
View this message in context: http://r.789695.n4.nabble.com/Running-Loops-tp4675886.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list