R/attachFormals.R

Defines functions .attachFormals

.attachFormals <- function(fun, envir = NULL) {
  
  if (is.null(envir)) envir <- parent.frame()
  f <- formals(deparse(substitute(fun)))
  f <- lapply(f, function(x) if(!is(x,"name")) eval(x) else x)
  mapply(assign, names(f), f, MoreArgs = list(envir = envir))
  NULL
  
}

Try the tcpl package in your browser

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

tcpl documentation built on Oct. 7, 2023, 1:06 a.m.