Creating file names.
Gregg You could either manipulate the character returned by today(), or try using Sys.time() instead. For example, on Windows, paste(strsplit(date(), ' ')[[1]][c(2,3,5,4)], collapse='_') gives Jan_09_2009_13:40:57 which approaches what you want. Alternatively format(Sys.time(), "%b_%d_%y_%H%M") gives Jan_09_09_1342 which only needs LMSMOD pasted to the front which sep='_'. HTH ... Peter Alspach
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of greggallen at gmail.com Sent: Friday, 9 January 2009 12:47 p.m. To: r-help at r-project.org Subject: [R] Creating file names. 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.
The contents of this e-mail are confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, disseminate, distribute or reproduce all or any part of this e-mail or attachments. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. Any opinion or views expressed in this e-mail are those of the individual sender and may not represent those of The New Zealand Institute for Plant and Food Research Limited.