I would like to add an average line to each of my facet plot (specific to each species & variable), but only managed to plot the facets without the line. I've attached a sample of the data as well if you'd like to try.
data_tidy = data %>%
group_by(species) %>%
gather(variable, value, duration, voiced, ampl_median, ampl_sd, amplVoiced_mean,
amplVoiced_median) %>%
dplyr::select(species,variable,value)
ggplot(data_tidy,aes(x=value,y=..scaled..,fill=variable))+
geom_density()+
facet_grid(species~variable,scales="free")+
geom_vline(data=data_tidy, aes(xintercept=mean(value)), colour="grey50")
Screenshot of attempt (without average line)
Sample data available at: https://drive.google.com/open?id=1u_6u6bXMfdut91bhAFIACHIt5CCGaMl2
Thanks in advance.