S3 Method Debugging Functions
S3_Method_Debug.Rd
Functions intended for use in interactive mode from within the browser()
.
Usage
ls_all(all.names = TRUE, env = parent.frame(), ...)
s3mag7(env = parent.frame())
browse(fn, ...)
Arguments
- all.names
a logical value. If
TRUE
, all object names are returned. IfFALSE
, names which begin with a . are omitted.- env
an
environment
to use in listing the available objects, equivalent to thename
argument ofls()
; defaultparent.frame()
i.e., theenvironment
in which the function was called.- ...
additional arguments passed to
ls()
orfn()
.- fn
a
function
to be called in “browser mode”.
Value
A character vector
for ls_all()
; for s3mag7()
, a named list
containing the following elements: -
.Class
.Class is a
character vector
ofclasses
used to find the nextmethod
.NextMethod()
adds an attribute"previous"
to .Class giving the .Class last used for dispatch, and shifts .Class along to that used for dispatch..Generic
A length-one
character vector
naming the generic function for the currentmethod
..GenericCallEnv
The environment of the call to be generic.
.GenericDefEnv
The environment defining the generic, used to find
methods
registered for the generic..Group
The generic
group
to which themethod
belongs, if applicable..Method
A character vector (normally of length one) naming the
method
function. (For functions in the generic groupOps
, it is of length two.)"object"
i.e., the
"object"
comprising the first argument of the call to.Generic
..class2("object")
The exact full
character vector
of the classes of"object"
used byUseMethod()
.
Details
ls_all()
returns a character vector
giving the names of all objects in its caller's
environment
including any that begin with a ‘.’, and is convenient shorthand for
ls(.all.names = TRUE)
, for instance when used from within the browser()
in interactive mode.
Intended for use while debugging an S3 method
in interactive mode with the
browser()
, s3mag7()
returns a named list of seven ‘special’ objects in the S3 method
dispatch environment
, see the Technical Details section of UseMethod
.
browse()
calls a specified function fn
in "browser" mode with suitable arguments provided in ...
. The
base function debug
is generally preferable.
See also
browser()
, class
, debug
,
environment
, methods()
, parent.frame()
and
UseMethod
Other methods:
S3Gen_Meth
,
method_info()
Examples
fn <- function() {
m <- "Mimi"
p <- "Poley"
.b <- "Blossom"
ls_all()
}
fn()
#> ls(all.names = TRUE) : -
#> [1] ".b" "m" "p"
#>
rm(fn)
## To run this in browser() interactive mode from R Console, select lines between
## "## Not run:" and "## End(Not run)" and hit [shift][enter]
if (FALSE) { # \dontrun{
## Two-by-two table for diagnostic test comparison
(twobytwo <- matrix(
c(31, 12, 4, 58),
nrow = 2,
dimnames = rep(list(c("+ve", "-ve")), 2) |>
setNames(c("Test1", "Test2"))
))
browse(print_all, cohens_kappa(twobytwo))
s
where
ls_all()
s
where
ls_all()
s
where
ls_all()
s
where
ls_all()
s3mag7()
f
rm(twobytwo)
} # }