I am converting a report to R from excel. My dataframe is like this
Color Year
Red 2020
Blue 2019
Blue 2020
Green 2020
Green 2019
Green 2020
Red 2019
Blue 2020
And I need a matrix with counts and then the mean and SD columns for each colour at end like this:
2019 2020 Mean SD
Red 1 1 1 0
Blue 1 2 1.5 1
Green 1 2 1.5 1
Any help appreciated, This takes me two mins in excel but I need to convert to R. Thanks in advance