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