I would like to check the column "state" within in a group (ID) for to see if numbers are only increasing.
Example:
df <-data.frame("ID" = c("A","A","A","B","B","B"),
"State"=c(1,2,3,1,4,2))
df %>%
group_by(ID) %>%
mutate(Check = ifelse(State > State[row.number() + 1], TRUE, FALSE)))
And the Output I was hoping for: Check: A - TRUE B - FALSE (because in this example 1,4,2 the numbers increases but then decrease)