[R] Exporting data

Adaikalavan Ramasamy gisar at nus.edu.sg
Fri Jul 11 16:16:49 CEST 2003


This really depends on what your output is. As previously suggested
save() and write() are excellent suggestions.

for(ii in 1:1000){
	out <- cor( x[ii, ], y[ii, ] ) # or whatever 
	cat(ii, "\t", out, "\n", append=TRUE, file="output.txt")
}

This method is really not worth it for small simulations but I found
this to be extremely useful with large simulations. 

The output file can act both as log/progress report file and provide
partial results even if your program crashes. More sophisticated method
can be found under connections().


-----Original Message-----
From: C.E.Marshall [mailto:C.E.Marshall at newcastle.ac.uk] 
Sent: Friday, July 11, 2003 4:59 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Exporting data


Dear All

I am a new user to R and so I have a question which I hope you can help
me 
with.

I am running simulations calculating correlation coefficients from
bivariate 
data and I was wondering whether there is a way of exporting 1000
simulation 
results from R to a text file or to another file for further
manipulation. I 
am having difficulty I think because of the text combined in with the 
numerical results.

Many Thanks

Carolyn Marshall

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list