Description Usage Arguments Value
View source: R/this_function.R
This function collects information about the function that it's
called from, based on the result from sys.status
. This
function can extract a variety of information, that other functions
can piggyback on instead of having to include large chunks of
similar code.
1 | this_function(n = 1, details = c(0, 1, 2, 3, 4))
|
n |
A positive integer that select which generations to
report. The default value |
details |
A value that is compared against the values
|
This function will return a result that depends on the
values of n
and details
, where the first
specifies which function to return whereas the latter one
decides the amount of information included as attributes. No
attributes will be added when details
is given as
0
. Higher values of details
adds attributes as
described below.
Attribute added when details
is greater than or
equal to 1
, which is a list that specifies the following
details about the function that has been returned:
origin
, package
, status
and
arguments
. The value in origin
presents the
place where the function was defined, which can be a namespace,
the global environment or the name of another function.
package
is a logical value that is true when
origin
refers to a package. status
will be
either exported
or internal
when the function
originates from some package, it will be global
if the
function was defined in the global environment, it will be
local
if it was defined in some other function, or it
will be unknown
if the algorithm couldn't select one of
the other ones (this might e.g. happen if a function has been
defined in an environment that has been attach
ed to the
search-path.
Attribute added when details
is greater than
or equal to 2
. This is a list having names equal to the
functions recorded from the call-stack, and each component of
this list contains details as given for the attribute
info
.
Attribute added when details
is greater
than or equal to 3
. A named list that gives the
sys.status
-information that was used to create the other
attributes, see the help-page of sys.parent
for the
details.
Attribute added when details
is greater than
or equal to 4
. A named list that for each occurrence of
a function adds a list with a component objects
, which
gives the content of the functions environment; and a component
is_test
that holds an array where these components has
been tested against the is.<something>
tests exported
from the namespaces. Note that the result listed here will be
the status at the time this_function
was called, and
that the status of the environments might have changed if it's
called at different times within the same target function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.