R/expand_tibble.R

Defines functions expand_tibble

Documented in expand_tibble

#' Creates a \code{tibble} from All Combinations
#'
#'  Actually a wrapper for \code{\link{expand.grid}}, but
#'  character vectors will stay as characters.
#'
#'
#' @param \dots  vectors, factors or a list containing these.
#' @return See \code{\link{expand.grid}} but instead of a
#'  \code{\link{data.frame}}
#'  a \code{\link{tibble}} is returned.
#' @author  Marsel Scheer
#' @seealso  \code{\link{expand.grid}}
#' @examples
#'
#' expand_tibble(fun = "rnorm", mean = 1:4, sd = 2:5)
#' @importFrom tibble as_tibble
#' @export
expand_tibble <-
  function(...) {
    tibble::as_tibble(expand.grid(..., stringsAsFactors = FALSE))
  }

Try the simTool package in your browser

Any scripts or data that you put into this service are public.

simTool documentation built on Jan. 8, 2021, 2:25 a.m.