#' @title force_categorical
#'
#' @description changes variables to be labeled as categorical
#'
#' @export
#'
#' @param variables a \code{\link[tibble]{tibble}} generated by \code{\link[mndredge]{identify_variables}}
#' @param columns the columns to update
#' @return the updated \code{\link[tibble]{tibble}}
#'
#' @author Mark Newman, \email{mark@trinetteandmark.com}
#' @keywords utilities
#' @family utilities
#'
#' @examples
#' \dontshow{
#' library(magrittr)
#' library(mndredge) }
#' data.frame(
#' a = 1:10,
#' b = 1:10) %>%
#' identify_variables() %>%
#' force_categorical("b")
#'
force_categorical <- function(variables, columns) {
stopifnot(
variables %>% is.tibble(),
columns %>% is.vector())
variables[variables$name %in% columns,]$type <- "categorical"
variables
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.