I have a data frame with two columns. The main one is GDP, the other is the quarter. I make the gdp graph is ok. However, when I add the moving average, it doesn't respect color or order.
graf <- data %>% ggplot(aes(x = TRIMESTRE)) +
geom_line(aes(y = PIB, colour = "black")) +
geom_line(aes(y = rollmean(PIB, 6, na.pad = TRUE), colour = "red"))
graf
Link of file: https://drive.google.com/drive/folders/1PHfkkaBRznQ8H1eMwLqg8ivFLjuw90BG?usp=share_link
It's a question because it's not right, because there are other ways to make the graph... it's more to know where I'm really going wrong.
I appreciate any help
I believe it should be with the colors as entered in the code...