Skip to content
Back to formatted view

Raw Message

Message-ID: <27A73859-7750-4784-B2F0-90006ADCDD41@micromata.de>
Date: 2013-01-17T11:56:51Z
From: Jessica Streicher
Subject: exporting simulated data
In-Reply-To: <CA+ivARhUqSggy_uHXUUM43T1ytD9cN=K4qop2x2_EOWBZ9EXfA@mail.gmail.com>

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.

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 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.