Skip to content

rleidv() not behaving as advertised #1942

@JoshOBrien

Description

@JoshOBrien

The Examples section of ?rleid begins with this code block:

 DT = data.table(grp=rep(c("A", "B", "C", "A", "B"), c(2,2,3,1,2)), value=1:10)
 rleid(DT$grp) # get run-length ids
 rleidv(DT, "grp") # same as above

Although the third line says "same as above", here's what I get when I run the second and third lines of code:

> rleid(DT$grp) # get run-length ids
 [1] 1 1 2 2 3 3 3 4 5 5
> rleidv(DT, "grp") # same as above
 [1]  1  2  3  4  5  6  7  8  9 10

Not sure whether I'm misunderstanding what rleidv() should do, or whether some breaking change has been introduced since this was last visited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions