R/dichotomixed.R

Defines functions dichotomixed

Documented in dichotomixed

dichotomixed <- function(data, out = "numeric") {
  res <- list()
  for(i in 1:ncol(data)) {
    if(is.factor(data[,i])) { 
      res[[i]] <- as.data.frame(dichotom(data[,i], out = out))
      names(res[[i]]) <- paste(colnames(data)[i], levels(data[,i]), sep = ".")
    } else {
      res[[i]] <- as.data.frame(data[,i])
      colnames(res[[i]]) <- colnames(data)[i]
    }
  }
  res <- as.data.frame(res)
  return(res)
}

Try the GDAtools package in your browser

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

GDAtools documentation built on May 29, 2024, 11:06 a.m.