powered by
Drops unused factor levels in data.frames
dropall(x)
a data.frame
data.frame
This function makes sure that the factor levels in a data.frame do not contain entries that have already been removed from the factor itself.
factor
levels
See also: http://en.opasnet.org/
a <- data.frame(A = c("a", "b"), B = c(1,1)) levels(a[[1]]) a <- a[-2 ,] levels(a[[1]]) a[[1]] a <- dropall(a) levels(a[[1]]) a[[1]]
Run the code above in your browser using DataLab