R/as.numeric.factor.R

Defines functions as.numeric.factor

Documented in as.numeric.factor

#sub function to fix categorical features
as.numeric.factor <- function(x,drop.levels=TRUE) {
  if(is.numeric(x)) return(x) ## if already numeric, do onothing
  if(drop.levels) x = match(x,levels(droplevels(x))) else x = match(x,levels(x))
  return(x)
}

Try the forestFloor package in your browser

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

forestFloor documentation built on May 2, 2019, 2:40 a.m.