I have a multi-column dataframe. How do I add the values of a column within an element of another variable? I want to do this to summarize the data of each species within each campaign. I have already tried using the summarize function of the plyr package but it did not work. It may be because I've factored in the function incorrectly.
campanha especie frequencia
1 A 2
1 A 1
1 A 3
1 A 5
1 B 1
1 B 2
1 B 1
1 B 6
1 B 1
1 C 3
1 C 1
1 C 8
1 C 4
2 A 2
2 A 8
2 A 4
2 A 5
2 B 4
2 B 2
2 B 6
2 B 1
2 C 3
2 C 1
2 C 9