[R] write file to date-stamped folder
David Huffer
David.Huffer at csosa.gov
Mon Aug 31 16:57:15 CEST 2009
How about:
> test.table <- matrix ( rnorm ( 25 ) , ncol = 5 )
> outputDir = paste (
+ getwd ( )
+ , "/OutputData-"
+ , Sys.Date ( )
+ , sep = ""
+ )
> dir.create ( outputDir )
> write.table (
+ test.table
+ , paste (
+ outputDir
+ , "test.table.txt"
+ , sep = "/"
+ )
+ , sep = "\t"
+ )
>
--
David
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of suzylee
Sent: Monday, August 31, 2009 3:45 AM
To: r-help at r-project.org
Subject: [R] write file to date-stamped folder
Hello,
I would like to be able to write all files produced on one day to an
output
directory with that date stamp, or alternatively stamp the date in the
filename. So that if i run the same code the next day the files will not
be
overwritten.
here's what i have to start with:
baseDir = getwd()
outputDir = paste(baseDir,"/OutputData-", Sys.Date(),sep="")
and lets say i want to write the table "test.table" to a file:
write.table(test.table, "test.table.txt", sep="\t")
How do i make this write to outputDir?
Thanks.
--
View this message in context:
http://www.nabble.com/write-file-to-date-stamped-folder-tp25219504p25219
504.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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