R/varClass.R

Defines functions varClass

Documented in varClass

##
## MissForest - nonparametric missing value imputation for mixed-type data
##
## This R script contains the function for defining variablewise data types.
##
## Author: D.Stekhoven, stekhoven@stat.math.ethz.ch
##############################################################################

varClass <- function(x){
  xAttrib <- lapply(x, attributes)
  p <- ncol(x)
  x.types <- character(p)
  for (t.co in 1 : p){
    if (is.null(xAttrib[[t.co]])){
      x.types[t.co] <- 'numeric'
    } else {
      x.types[t.co] <- 'factor'
    }
  }
  return(x.types)
}

Try the missForest package in your browser

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

missForest documentation built on April 14, 2022, 5:05 p.m.