(x <- structure(c(3L, 3L, 3L, 3L, 1L, 2L, 2L,
2L, 2L, 3L, 2L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L),
.Label = c("B", "C", "D"), class = "factor"))
[1] D D D D B C C C C D C B B C C C C C C C C C
Levels: B C D
> x[c(TRUE, diff(as.numeric(x))!=0)] [1] D B C D C B C Levels: B C D
Keine Kommentare:
Kommentar veröffentlichen