S3 Method Debugging Functions
S3_Method_Debug.RdFunctions 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
environmentto use in listing the available objects, equivalent to thenameargument ofls(); defaultparent.frame()i.e., theenvironmentin which the function was called.- ...
 additional arguments passed to
ls()orfn().- fn
 a
functionto 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 vectorofclassesused 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..GenericA length-one
character vectornaming the generic function for the currentmethod..GenericCallEnvThe environment of the call to be generic.
.GenericDefEnvThe environment defining the generic, used to find
methodsregistered for the generic..GroupThe generic
groupto which themethodbelongs, if applicable..MethodA character vector (normally of length one) naming the
methodfunction. (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 vectorof 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)
} # }