1

How can I save a file in a specific folder which has Sys.date()?

write.csv(dummy_opp, file = "//ant/dept-as/XYZ2-User/Mega_data/File Management/SOA/Assignment-(***This folder is appended by sys.date***)"Workbook.csv",row.names = FALSE)

Terru_theTerror
  • 4,918
  • 2
  • 20
  • 39

1 Answers1

3

Try this:

date<-as.character(Sys.Date())
  write.csv(dummy_opp, file = paste0("//ant/dept-as/XYZ2-User/Mega_data/File Management/SOA/Assignment-",date,"/Workbook.csv"),row.names = FALSE)

file will be:

"//ant/dept-as/XYZ2-User/Mega_data/File Management/SOA/Assignment-2018-02-19/Workbook.csv"

Or, if you want a more compact code:

  write.csv(dummy_opp, file = paste0("//ant/dept-as/XYZ2-User/Mega_data/File Management/SOA/Assignment-",Sys.Date(),"/Workbook.csv"),row.names = FALSE)
Terru_theTerror
  • 4,918
  • 2
  • 20
  • 39