[R] Loop with random sampling and write.table
Pete Pete
noxyport at gmail.com
Sat Sep 3 15:57:02 CEST 2011
Hi!
I need to perform this simple sampling function several hundred times:
x1=as.character(rnorm(1000, 100, 15))
x2=as.character(rnorm(1000, 150, 10))
y1=as.data.frame(x1,x2)
sample1=as.data.frame(sample(y1$x1, 12, replace = FALSE, prob = NULL))
sample1
write.table(sample1, "sample1.txt", sep=" ",row.names=F,quote=F)
My knowledge of loops is quite low. How can I produce 100 loops of the
sampling leading to 100 files from sample1.txt to sample100.txt?
Thanks for you help!
--
View this message in context: http://r.789695.n4.nabble.com/Loop-with-random-sampling-and-write-table-tp3787895p3787895.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list