Simple question but how do you save the name of a dataframe as the excel filename if it's in a function?
export_origin <- function(df){
df1 <- unite(df, variable, c(Reaction.Type, Trial, Actual.Total.Seconds))
df2<- dcast(df1, X.nm.~variable, value.var = "X.A.")
fname= paste(df, "xls", sep = ".")
write.xlsx2(df2, file = fname, col.names = TRUE)}
I want fname=df.xls with whatever the df name is that I input but it saves it as the observations within the dataframe as the name.
substitute(df)uniteis fromdplyranddcastis fromreshape2. But where doeswrite.xlsx2come from? I think you might want to add more details.