check_method | R Documentation |
::
.Method body could contain names like "mutate" that are from packages,
it usually would not be a problem as long as the package namespace is in
the search path or it is available in the parent environment of the object.
However, if the package is not loaded via functions like library()
and
the name used in the method body is unavailable in the parent environment of
the object, then an error may be raised saying that "object name
not found"
when the method is run.
This function helps detect this kind of
problems. Users needs to specify the names they want to detect, and specify
the package they belong to.
check_method(env, symbol_name, target_namespace)
env |
Environment. An environment. |
symbol_name |
Character. Names that want to be detected. |
target_namespace |
Character. Name of the package that symbols belong to. |
No return value, called for side effects.
e <- new.env()
register_method(e, test = function() cli_alert_info("test"))
check_method(e, "cli_alert_info", "cli")
register_method(e, test = function() cli::cli_alert_info("test"))
check_method(e, "cli_alert_info", "cli")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.