I have a data frame with 66 species with 3 years of relative abundance an I want to do a graph in R with ggplot2 to show the abundance of each year for each species. The problem is that to do a graph like that I need a different shape of my data frame and I can't find the code to change it.
So, my data frame is:
Species 2016 2017 2018
Sp1 4 8 3
Sp2 0 0 1
Sp3 6 4 8
Sp4 7 5 5
...
The data frame that I need for the graph should have the following shape:
Year Abundance
Sp1 2016 4
Sp1 2017 8
Sp1 2018 3
Sp2 2016 0
Sp2 2017 0
Sp2 2018 1
Sp3 2016 6
...
I am sure there is a way, there is always a way, but I can't find it :(