#' 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)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.