Am Donnerstag, 8. Februar 2007 21:33 schrieb Aldi Kraja:
> Is there any other solution better than creating separate directories in
> R? I am thinking if there is any option in R to create a unique id which
> has its own unique .Rdata, although in the same directory?
You could try using tempfile() in combination with basename(). From the
helppage on tempfile():
The names are very likely to be unique among calls to 'tempfile'
in an R session and across simultaneous R sessions. The filenames
are guaranteed not to be currently in use.
So this is my suggestion for the generation of a useful, unique id in your
working dir:
prefix <- paste("var_", var, sep = "")
while(file.exists(id <- basename(tempfile(pattern = prefix)))) {}
save(result, file = paste(id, ".Rdata", sep = ""))
Hope this helps.
Michel Lang
______________________________________________
[email protected] 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.