[R] naming files or lists

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Mar 17 17:06:31 CET 2014


Generate the desired name(s) as character variables and use those variables as the filename when saving it (them).

?paste
?paste0
?sprintf
?format.POSIXct

If you have not converted your timestamps to a time data type yet then you probably need to do that. You may be able to hack something together with substr, but you won't get the format validation and sorting benefits of working with true time data types.

Please read the Posting Guide which warns you to post using plain text email so we see what you see.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On March 17, 2014 8:05:23 AM PDT, Olivier Charansonney <olivier-luc.charansonney at laposte.net> wrote:
>Hello,
>
>I would like to name files (.txt, .pdf or lists (or dataframes) with
>names
>composed from subjects' IDs, dates, and times e.g. 003DE, 03 17 2014
>and
>16:02:30 gives a file named 003DE-031714-160230.txt.
>
>How can I do that?
>
>Thanks for your help.
>
> 
>
>
>	[[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.




More information about the R-help mailing list