I have a data frame with two columns: X and Y.
The X column consist of different years, and I need to count how many rows I have per each year. For example:
X Y
year 1
year 1
year 1
year 1
year 2
year 2
year 2
year 3
year 3
...
The data frame is big, I don't know how many years I have. So I thought using the group_by function but I don't know how.
Finally I need to see the following output:
year 1 4
year 2 3
year 3 2