[R] Creating file names.

Don MacQueen macq at llnl.gov
Fri Jan 9 02:26:53 CET 2009


Your easiest starting point is probably

   file = format(Sys.time())

and then look at the online help for the strptime function to learn 
about formatting options.

For example
   format( Sys.time() , '%m%d%y' )

Use paste() and some formatting of Sys.time() to construct the form 
you are looking for.

-Don

At 4:47 PM -0700 1/8/09, greggallen at gmail.com wrote:
>I have a function that is called from a "sourced" script, whenever
>certain conditions are met.
>
>I have this inside it:  if(P > 0.9)save( file = today() , myLMSmodel );
>
>
>This gives me files that look like this: Thu Jan  8 14:04:43 2009
>
>That works fine on my Mac, but it would be much more convenient to
>have something like this:
>
>LMSMOD_Jan_08_09_1404
>
>
>Does anyone know how I can do this?
>
>(You don't have to put in the underscores, if it's too much work.)
>
>Thanks,
>
>
>Gregg Allen
>
>______________________________________________
>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.


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062




More information about the R-help mailing list