R/fLogic2Numeric.R

Defines functions fLogic2Numeric

Documented in fLogic2Numeric

#' Converts dataframe columns of class 'logical' to class 'numeric.'
#' @export
#' @title Convert logical to numeric
#' @param dat a dataframe.


# fLogic2Numeric - Converts columns of class 'logical' to class 'numeric.'
fLogic2Numeric <- function(dat) {
  dat <- data.frame(lapply(dat, function(x) if(is.logical(x)) {
    return(as.numeric(x))
  } else {
    return(x)
  }
  ), stringsAsFactors=FALSE)
}
ksmiff33/FluxSynthU documentation built on Dec. 15, 2020, 10:29 p.m.