R/droplevels.colored.R

Defines functions droplevels.colored

Documented in droplevels.colored

##' Drop unused levels from a colored factor and its color key
##'
##' This subclass method extends \code{droplevels.factor} to handle
##' updating of the special color key attribute of colored factors.
##' @title Drop unused levels from a colored factor
##' @param x a colored factor
##' @param ... further arguments passed to methods
##' @return a colored factor with no unused levels
##' @method droplevels colored
##' @author David C. Norris
##' @export
droplevels.colored <- function(x, ...){
  color.key <- key(x)
  x <- droplevels.factor(x)
  colored(x, color.key[levels(x)])
}

Try the VizOR package in your browser

Any scripts or data that you put into this service are public.

VizOR documentation built on May 30, 2017, 5:29 a.m.