R/template_function.R

Defines functions template_function

Documented in template_function

#' Bind two factors
#'
#' Create a new factor from two existing factors, where the new factor's levels
#' are the union of the levels of the input factors.
#'
#' @param a factor
#' @param b factor
#'
#' @return factor
#' @export
#'
#' @examples
#' template_function(iris$Species[c(1, 51, 101)], PlantGrowth$group[c(1, 11, 21)])
template_function <- function(a, b) {
  factor(c(as.character(a), as.character(b)))
}
annack84/STMdevelopment documentation built on April 12, 2024, 6:46 p.m.