Chad
Chad

Reputation: 149

write.table/ adding date automatically

I am using the write.table function.

    #code
    write.table(file, file="MY NAME", col.names=T, row.names=FALSE);

I also want to add the date automatically each time, thus each file will have the same name an only vary by date? I have tried #Sys.time(); but this isnt working. Any ideas guys?

Upvotes: 1

Views: 3116

Answers (3)

cianius
cianius

Reputation: 2412

 write.table(dat, file = paste("FILE", Sys.time(), sep="_"))

Upvotes: 0

GWD
GWD

Reputation: 1464

Try and give this a shot

write.table(data, file=paste0("SomeName", Sys.Date()))

Upvotes: 0

joran
joran

Reputation: 173577

I think you're looking for:

write.table(file, file=paste("MY NAME",Sys.Date(),sep = "_"), col.names=T, row.names=FALSE)

or something similar.

Upvotes: 2

Related Questions