Here's a code that will help with the sequence:
dd<-structure(list(ID = c(1L, 2L, 3L, 4L, 1L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 6L, 3L, 3L, 3L, 1L, 2L, 3L, 3L, 5L, 6L, 7L, 5L, 4L,
2L, 3L, 1L, 5L, 6L, 1L, 1L), Timestamp = structure(c(18262, 18262,
18263, 18264, 18264, 18264, 18266, 18266, 18267, 18268, 18269,
18270, 18271, 18271, 18271, 18271, 18271, 18272, 18272, 18272,
18272, 18272, 18273, 18273, 18273, 18273, 18274, 18274, 18275,
18275, 18275, 18276, 18277), class = "Date"), Status = c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 1L, 3L, 3L, 3L, 3L, 2L, 1L, 4L, 5L, 6L,
4L, 3L, 4L, 2L, 3L, 4L, 5L, 6L, 7L, 3L, 4L, 5L, 3L, 4L, 6L, 7L
)), .Names = c("ID", "Timestamp", "Status"), row.names = c(NA,
-33L), class = "data.frame")
Next, you define a helper function to test all the difference in the status values are all 1 and that we have all seven of them
isgoodseq<-function(x) {
length(x) ==7 & all(diff(x)==1) & min(x)==1
}
After which, you can run this for each ID
with(dd[order(dd$Timestamp, dd$ID, dd$Status),],
tapply(Status, ID, isgoodseq))
This is the output:
1 2 3 4 5 6 7
TRUE FALSE FALSE FALSE FALSE FALSE FALSE
Which means 1 is the only good ID