I learn R and the tidyverse and I can not find an answer to my question because I lack the proper vocabulary to describe what I want to achieve.
I have a large dataset with that structure :
df <- tibble(x = c("species1", "species2", "species1", "species3"), y = 1:4)
and I need to "compress" it into that modified dataframe by adding the observations for each unique species
df_modif <- tibble(x = c("species1", "species2", "species3"), y = c(4,2,4))
Could someone help me by explaining if there is a way to achieve this, please? And is there a word to describe that "compression" of a dataframe?
Have a nice day