I'm trying to get a count of rows grouped by a certain variable using dplyr.
Example of the data below
Get a count of eunits = 0 by state.
Code that does not work:
data %>% select(state, eunit) %>% filter(eunit == 0) %>% summarise(nrow(.)) %>% group_by(state)
Error that comes up:
Error in grouped_df_impl(data, unname(vars), drop)