I have a data frame with three columns: State1, State2, State3. Is there a way to get the counts of each state in one dataframe, using all three columns (preferably with dplyr and without an explicit loop)? I only figured out how to do one column:
df %>% group_by(State1) %>% summarise(n=sum(!is.na(State1)))
gather(df) %>% group_by(key, val) %>% summarise(n = sum(!is.na(val)))?\ - akrun