The main idea of a rather complicated ggplot like yours is to separate the data preparation from the actual plotting. At the stage of data preparation, you can organize your data in accordance with the construction concept that you have in mind.
In your case, this involves a preliminary calculation of the statistics in question:
df_vline <- rbind( aggregate(pm[1], pm[2], quantile, .8), aggregate(pm[1], pm[2], median) ) df_vline$stat <- rep(c("percentil .8", "mediana"), each = nrow(df_vline) / 2)
and then the mapping scheme is pretty simple, so you don’t have to think about manually redefining the legend.
ggplot(data=pm, aes(x=pm10, y=..density..)) + geom_histogram(bin=15, fill='#deebf7', colour='#bdbdbd')+ geom_density(size=1, colour='#cccccc')+ geom_vline(data=df_vline, mapping=aes(xintercept=pm10, colour = stat), linetype = 1, size=1, show_guide = T)+ geom_text(data=curtosis, aes(x=350, y=.010, label=V1), size=3, parse=T)+ geom_text(data=asimetria, aes(x=350, y=.008, label=V1), size=3, parse=T)+ scale_colour_manual(values = c("#dfc27d","#80cdc1"), name = "Medida de tendencia")+ xlim(0,500)+ facet_wrap(~ estacion, ncol=2)

(Good story, by the way.)