I am trying to get R to create a tibble for this, but it keeps having errors. First it said that summarise was an ungrouping output and to override with .groups, but that didn't work so I put ungroup before summary and now it is saying that n() can only be used inside dplyr verbs even though it is in one, summarise. Can someone please help me.
Looks like you are missing a pipe operator (%>%) before summarise.
I also don't think that you want to have ungroup() directly behind group_by() since it removes the grouping your are adding right before. The message you got only tells you that your output will not keep the grouping that you have specified before but the code still works. I suppose the message is just there to make clear what behaviour you should expect from your results.
Without knowing your data, I guess that this should work:
Without the commas the programme is reading it all as one line, like missing punctuation in a paragraph makes no sense. The error Error: unexpected ')' in " )" is suggesting you are missing an end bracket but that's not what is missing in this case but it's a common thing to miss.