sourcing | R Documentation |
sourcing()
returns TRUE
if it seems that it is called from a file that
is being sourced, e.g., with \linkIntsource or \linkIntsys.source.
Otherwise, it returns FALSE
. The command is helpful when we want a
file to behave differently depending on whether it is sourced.
sourcing()
sourcing()
is just an alias for sys.nframe() != 1L
.
interactive, \linkIntsys.nframe
The function was inspired by inspired by interactive()
, which
detects whether a command is being run interactively. Stack Overflow user
r2evans wrote a helpful post: see https://stackoverflow.com/a/47932989/697473.
if (sourcing()) { print("It seems that this code is being sourced. It's not being executed directly from the global environment.") } else { print("It seems that this code is not being sourced. It's being executed directly from the global environment.") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.