Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

write.csv with with sys.time in file name [duplicate]

Tags:

r

I need to generate many csv files a day and story in a folder with the process time in the file name.

I tried to append the system time to the file name but was not able to do it using paste0

write.csv(output, paste0("C://Users/My Computer/dir", Sys.time(), ".csv"))

Is there a way to include system time in the file or is the user of these files better of finding a function to read these files by modification date ?

like image 927
Blas Avatar asked Aug 25 '16 00:08

Blas


1 Answers

A work around is to format the system time differently. I got around this by replacing the ":" character with "."

write.csv(output, paste0("C://Users/My Computer/dir", format(Sys.time(), "%d-%b-%Y %H.%M"), ".csv"))
like image 86
Blas Avatar answered Nov 15 '22 05:11

Blas