R/transformBooleanIntoAnotherBoolean.R

Defines functions transformBooleanIntoAnotherBoolean

Documented in transformBooleanIntoAnotherBoolean

#' Transform boolean into another boolean
#' 
#' Transform boolean into another boolean.
#' 
#' Length of vector members in mode list must be of the same length.
#' 
#' @param boolean_vec Boolean vector of any length
#' @param mode List where first element is boolean vector that wish to transform, while second element is a boolean vector that we want the input vector to be transformed into.
#' @return Transformed boolean vector of length 2
#' @export  
#' 

transformBooleanIntoAnotherBoolean = function(boolean_vec,mode=list(c(T,T),c(F,T))){
  stopifnot(length(mode[[1]])==length(mode[[2]]))
  if(identical(boolean_vec,mode[[1]])){
    return(mode[[2]])
  }
  else{
    return(boolean_vec)
  }
}
msxakk89/dat documentation built on Aug. 3, 2020, 6:39 p.m.