R/copy_args.R

Defines functions copy_args

Documented in copy_args

#' Copies the arguments of one function to another
#'
#' Copies the arguments of  one function, "from", to "to".
#'
#' @param from A function with the arguments to copy
#' @param to A function to receive new arguments
#'
#' @return function
#'
#' @seealso See \code{\link{tictocify}} function body for a use case.
#'
#' @export
#'


copy_args <- function(from, to) {

  # Error checking
  assert_that(is.function(from), is.function(to))
  assert_not_primitive(from, to)

  int_f <- to
  formals(int_f) <- formals(from)

  return(int_f)
}

Try the frite package in your browser

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

frite documentation built on July 1, 2018, 5:04 p.m.