get_function <- function(
param, file_format, param_defs = get("harp_params")
) {
param_info <- param_defs[[param]][[file_format]]
func <- param_info[["func"]]
if (is.null(func)) {
param_info <- param_defs[[param]]
func <- param_info[["func"]]
}
if (is.null(func)) {
return(NA)
}
if (is.function(func)) {
return(func)
}
if (!is.character(func)) {
stop(
"`func` must be a function or a string representing a function",
call. = FALSE
)
}
if (is.null(param_info[["func_pkg"]])) {
func <- try(get(func), silent = TRUE)
if (is.function(func)) {
return(func)
}
stop(
"`func` must be a function or a string representing a function",
call. = FALSE
)
}
func <- try(
get(func, envir = asNamespace(param_info[["func_pkg"]])),
silent = TRUE
)
if (is.function(func)) {
return(func)
}
stop(
"`func` must be a function or a string representing a function",
call. = FALSE
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.