logical value count with summarise r
问题 In a data frame, I have a column with Y and N values. This data frame also has an id column. I would like to create two columns, one with the total Y count and another with the total N count for each id. I tried doing this procedure with the dplyr summarise function group_by(id) %>% summarise(total_not = count(column_y_e_n == "N"), total_yes = count(column_y_e_n == "Y") but objected to the error message Error in summarise_impl(.data, dots) Any sugestion? 回答1: Slight variation on original