write.csv(z, paste("c:/z_",i,".csv"sep=''))
You will have to modify this to prepend 0s.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.list at gmail.com
On Jul 13, 2010, at 10:03 AM, Michael Haenlein wrote:
> Dear all,
>
> I have a code that generates data vectors within R. For example
> assume:
> z <- rlnorm(1000, meanlog = 0, sdlog = 1)
>
> Every time a vector has been generated I would like to export it
> into a csv
> file. So my idea is something as follows:
>
> for (i in 1:100) {
> z <- rlnorm(1000, meanlog = 0, sdlog = 1)
> write.csv(z, "c:/z_i.csv")
>
> Where "z_i.csv" is a filename that is related to the run (e.g.
> z_001.csv,
> z_002.csv, ...).
>
> Could anyone please advice me on the most convenient way of doing
> this?
>
> Thanks very much in advance,
>
> Michael
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.