I have a data frame with yes/no values for different days and hours. For each day, I want to get a total number of hours where I have data, as well as the total number of hours where there is a value of Y.
df <- data.frame(day = c(1,1,1,2,2,3,3,3,3,4), hour = c(1,2,3,1,2,1,2,3,4,1), YN = c("Y","Y","Y","Y","Y","Y","N","N","N","N")) df %>% group_by(day) %>% summarise(tot.hour = n(), totY = WHAT DO I PUT HERE?)