I'm plotting a list of data frames.
These are the names of the data frames:
names(meltmean)
[1] "A" "B" "C" "D" "E" "F"
I used this to plot:
stacked<-lapply(meltmean,
function (x) ggplot(x, aes(x=month, y= value, fill=Type))+geom_area()+ggtitle(names(meltmean)))
I want to get the title of each data frame in each plot, but for all I'm just getting the first name. So in all plots the title is "A".
I also tried with + ggtitle(names(x)) but with that I get the name of the first column of each data frame, not the name of the data frame.
What do I need to change so I get the correct name in each plot?