I have a DF with two columns (1) = referral source e.g "NHS" which are character strings, and (2) = quarters e.g., 2021 Q1 created with the code
referral_df$quarters <-as.yearqtr(referral_df$date,format = "%Y-%m-%d")
I want to create a separate DF that sums the number of referrals by source e.g., NHS, private etc. by quarter
so
2021Q1 NHS = 400
2021Q1 private = 200
or
Quarter Source Count
2021Q1 NHS 400
2021Q1 Private 200
Any suggestions?