need | R Documentation |
If the package is not installed then the function will error and give an appropriate message.
need(package)
package |
a package name as a character string. |
Designed to be used in scripts or functions where a function from the named package is used with ::
without attaching the package. It should be used alongside library()
calls at the top
of scripts where it also serves the purpose of indicating to the user that a package is needed.
The function uses requireNamespace()
which will load the package if available but not attach it.
This is what happens when ::
is used.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.