conditional var count with different classes in R -


i have data frame looks that:

class    id  rank        aa  win b        aa  win b        ab  win c        bb  win d        ab  win e        bb  win e        aa  win 

how can efficiently count how wins per id have condition of class lower e (not inclusive)?

a dplyr solution:

library(dplyr) df%>% group_by(id) %>% filter(class !="e") %>%summarize(n()) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -