I want to count the number of times a zip code shows up in a column. I have three columns of data: State, City and Zip Code. I've been able to group the data by State and City. Each city has multiple zip codes. I want to be able to count how many times zip code 70000 shows up and how many times zip code 70001 shows up, etc. I'm thinking a new column would need to be created to do this: State, City, Zip Code, Zip Code Count, where Zip Code Count would not count how many zip codes are in the city, but how many TIMES each zip code appears in each city.
I've used the sum function but it is treating the zip code like a number and is calculating the value. I want to be able to count how many times each zip code appears in each group.
Here's my code so far (that gets me a calculated value, which is NOT what I want):
group_by(customer_state, customer_city) %>%
Any feedback and suggestion is greatly appreciated.