Hello,
Em 17-01-2013 11:56, Jessica Streicher escreveu:
Rather unspecific.

Basically you'd need a loop to create the sets, and a way to write them into a 
file.

You did not specify the format of your data. You might be able to use write, 
write.table or write.csv and the like.
You could also have a look at ?save which allows you to save any R object.

You also did not specify how important that filename format is. For example:

for(i in 1:5){
        #create data
        someData <- i
        #create filename
        filename<-paste("data",i,".dat",sep="")
        #save data
        write(someData,filename)
}

This would make unique filenames but not quite what you wanted.

For this maybe

filename <- sprintf("data%04d.dat", i)


Hope this helps,

Rui Barradas

greetings,
Jessi

On 17.01.2013, at 04:31, Ray Cheung wrote:

Dear All,

I wrote a function datagen to simulate a dataset. I would like to generate
1000 datasets and export them with file names from data0001.dat to
data1000.dat. Would anybody please provide some useful codes on this? Thank
you very much.

Best Regards,
Ray

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to