R/process_pre_eval.R

Defines functions process_pre_eval

#####################################################
# process_pre_eval
# Performs function calls on which the main functions
# are dependent.
#
# Author:  Lora Murphy, Cary Institute of Ecosystem Studies
# murphyl@caryinstitute.org
#####################################################
process_pre_eval<-function(pre_evals, eval_results, ...) {

  if (length(pre_evals) > 0) {
    for(i in 1:length(pre_evals)) {
      if (!is.null(pre_evals[[i]]$pre_eval)) {
        eval_results = process_pre_eval(pre_evals[[i]]$pre_eval, eval_results, ...)
      }
      if (is.null(list(...)) == FALSE && any(names(formals(pre_evals[[i]]$fun))=="...")) {
        for (j in 1:length(list(...))) {
          pre_evals[[i]]$call[[names(list(...))[[j]]]]<-list(...)[[j]]
        }
      } 
      eval_results[[pre_evals[[i]]$parname]]<-do.call(pre_evals[[i]]$fun, pre_evals[[i]]$call)
    }
  }
  eval_results
}

Try the likelihood package in your browser

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

likelihood documentation built on March 31, 2023, 9:02 p.m.