This should be a simple question. I tried to rank "date" within each group (name) and save the rank output as rank_date.
However, I kept receiving the error "Error in df %>% group_by(name) %>% rank_date <- mutate(df, rank = order(score, : could not find function "%>%<-""
df = data.frame(name=c("A","A","A","B","C","D"), score = c("03/21/2021", "04/21/2021", "05/21/2021", "06/21/2021","07/21/2021","03/21/2021"))
df$score = as.Date(df$score,"%m/%d/%Y")
df %>%
group_by(name)%>%
rank_date<-mutate(df, rank=order(score, decreasing=TRUE))
df %>% group_by(name) %>%mutate(rank_date = order(score, decreasing = TRUE))
– akrun