R/relevel.R

#' @method relevel lfactor
#' @export
relevel.lfactor <- function(x, ref, ...) {
	xf <- x
	class(xf) <- "factor"
	res <- relevel(xf, ref, ...)
	ll <- llevels(x)
	ll <- c(ll[levels(x) == ref], ll[levels(x) != ref])
  attr(res,"llevels") <- ll
  class(res) <- c("lfactor", "factor")
  res
}

Try the lfactors package in your browser

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

lfactors documentation built on May 2, 2019, 8:29 a.m.