R/assign.R

#' @method [<- lfactor
#' @export
"[<-.lfactor" <- function(x,i, value) {
	cc <- value %in% llevels(x)
	ll <- llevels(x)
	lapply(1:length(llevels(x)), function(j) {
		value[value==ll[j]] <- levels(x)[j]
		value <<- value
  })
	NextMethod()
}

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.