R/checksolver.R

checksolver <- function(method, allmeth, allpkg){
#    basestats <- c("Nelder-Mead","BFGS","L-BFGS-B","CG","SANN", "nlm", "nlminb", "hjn")
#    if (method %in% basestats) return(method)

    imeth <- which(method == allmeth)
    pkg <- allpkg[imeth]

    if (requireNamespace(pkg, quietly = TRUE)) {
      return(method)
    } else {
      warning("Package ",pkg," for method ",method," is not available")
      return(NULL)
    }     
    NULL # just in case
}

Try the optimr package in your browser

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

optimr documentation built on May 2, 2019, 6:49 p.m.