Hello all,
I want to write a custom function to write data.frames to excel and I need to get the name of the data frame inside the function as in
fun <- function(df){
foo(df) -> name
# foo is the function I need to get the name of the object
writexl::write_xlsx(x = df,path = paste0(name,"xlsx"))
}
when I use the deparse(substitute(df)) method it just gives me "df" but I need a function that gives me the name the "df" value is assigned to. like if I use fun(df=iris) I want the file to be automatically named (iris.xlsx). Thanks in advance.