1

如何将文件保存在具有 的特定文件夹中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)

4

1 回答 1

3

尝试这个:

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将会:

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

或者,如果您想要更紧凑的代码:

  write.csv(dummy_opp, file = paste0("//ant/dept-as/XYZ2-User/Mega_data/File Management/SOA/Assignment-",Sys.Date(),"/Workbook.csv"),row.names = FALSE)
于 2018-02-19T08:24:23.213 回答