'Renaming excel file created in R with variable name using write.xlsx

I have a data frame which I want to store in an excel file. Additionally, I have a variable with name dateofentry which has a value. I want the excel file which will be saved to have this variable name in it along with word report. I have written the following code, however no file is getting created. Can someone please help in this regard. Thanks

library(openxlsx)

first_col <- c("A","B","C")
second_col <-c("1","2","3")

df<- data.frame(first_col,second_col)

dateofentry <- "02/03/2022"
filename=paste0(dateofentry,'-',"report")
write.xlsx(df,file=filename)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source