Skip to content
Prev 333525 / 398513 Next

How do I identify non-sequential data?

Dan,
Does this do it?

## where dt is the data

tmp <- split(dt, dt$ID)

foo <- lapply(tmp, function(x) any(diff(x$YoS) > 1))

foo <- data.frame( ID=names(foo), gap=unlist(foo))

Note that I ignored dept.
Little hard to see how YoS can increase by more than one when the year
increases by only one ... unless this is a search for erroneous data.

-Don