Joel B Joel B - 1 year ago 81
R Question

How to include value within he file= string of a write.xlsx command

I'm struggling with finding out how to get a vlaue to resolve within speech marks. In the blow example, the is a load of other code logic between the setting of outputfolder and the write.xlsx line. Any suggestions?

client_name <-"client a"
project_name <-"project x"
outputfolder <-"D:/client_abc_folder"

write.xlsx(df, file="outputfolder/client_name_project_name.xlsx", sheetName="my analysis", row.names = FALSE, append=TRUE)

Answer Source

Use paste0(outputfolder, "/", client_name, "_", project_name, ".xlsx")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download