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