Suppose I have the following database:
df <- data.frame(categorias=c("A","B","C","D","E"),
valores=seq(1:5))
When I make a subset of that date frame the categories I've removed continue.
subdf <- subset(df, valores <= 3)
levels(subdf$categorias)
[1] "A" "B" "C" "D" "E"