You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(But, I think this is not dplyr's job. Maybe tidyr can fit since this is the similar problem which functions like fill() try to solve in that they both are about how to work with consecutive rows.)
lockbot
locked as resolved and limited conversation to collaborators
Jun 7, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi
it would be cool to have data.table::rleid in dplyr for grouping, window functions etc.
http://stackoverflow.com/questions/33507868/is-there-a-dplyr-equivalent-to-data-tablerleid
myrleid <- function(x) {
x <- rle(x)$lengths
rep(seq_along(x), times=x)
}
DT <- data.frame(grp=rep(c("A", "B", "C", "A", "B"), c(2,2,3,1,2)), value=1:10)
DT %<>% mutate(rlid = myrleid(grp))
DT
Greetings
Christof
The text was updated successfully, but these errors were encountered: