#' Read algorithms
#'
#' @description
#' Function reads optimization algorithms to current environment from
#' specified directory by YAML-config or from default directory.
#'
#' @param .dir directory with R source code of methods :: string
#' @export
source_dir = function(.dir = "./Algs") {
files =
base::list.files(path = .dir, full.names = TRUE)
files %>%
purrr::map(base::source)
}
#' Check availability of method
#'
#' @description
#' Function checks if specified by YAML-config algorithms are available.
#'
#' @param .funcs functions :: [function]
#' @export
find_methods = function(.funcs) {
.funcs %>%
purrr::map(function(func) {
if(func %in% ls(envir = .GlobalEnv)) {
cli::cli_div(theme = list(span.emph = list(color = "green")))
cli::cli_alert_success("Algorithm {.emph {func}} is available.")
}
else {
cli::cli_div(theme = list(span.emph = list(color = "red")))
cli::cli_alert_danger("There is no algorithm {.emph {func}} in specified directory!")
}
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.