.optional_fn | R Documentation |
You want to use a function if it is installed but don't want it to be installed as part of your package and you don't want to reference it as part of the Imports or Suggests fields in a package DESCRIPTION.
.optional_fn(
pkg,
name,
alt = function(...) {
stop("function `", pkg, "::", name, "(...)` not available")
}
)
pkg |
the package name |
name |
the function you wish to use |
alt |
a function that can be used instead |
the function you want if available or the alternative
fn = .optional_fn("openssl", "md5", digest::digest)
as.character(fn(as.raw(c(1,2,3))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.