R/fbind.R

#' @title  Bind two factors together
#' @description Bind two factors together.
#' Numeric values are not allowed. Characters are coerced to factors.
#' Look at the examples in the vignette for usage.
#'
#' @param a factor
#' @param b factor
#'
#' @return factor
#' @export
#' @examples
#' fbind(iris$Species[c(1,51,101)], PlantGrowth$group[c(1,11,21)])
fbind <- function(a,b) {
        if(is.numeric(a) | is.numeric(b)){stop('One or more inputs are numeric!')}
        factor(c(as.character(a), as.character(b)))
}
KPdir/foofactors documentation built on May 8, 2019, 4:41 p.m.