[R] How can I store the results
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Jan 13 18:19:22 CET 2010
On Wed, 2010-01-13 at 15:59 +0100, Alex Roy wrote:
> Dear R users,
> I am running a R code which gives me 10 columns and
> 160 rows. I need to run the code for 100 times and each time I need to store
> the results in a single file.
> I do not know how can I store them in a single file without over writting
> the results?
In a list?
results <- vector(mode = "list, length = 100)
for(i in seq_along(results) {
## do something
## ....
## store result for iteration i
results[[i]] <- something
}
results will now contain 100 matrices of dim 160x10.
HTH
G
>
> Thanks
>
> Alex
>
> [[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.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list