Skip to contents

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. If FALSE, names which begin with a . are omitted.

env

an environment to use in listing the available objects, equivalent to the name argument of ls(); default parent.frame() i.e., the environment in which the function was called.

...

additional arguments passed to ls() or fn().

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 of classes used to find the next method. 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 current method.

.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 the method belongs, if applicable.

.Method

A character vector (normally of length one) naming the method function. (For functions in the generic group Ops, 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 by UseMethod().

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.

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)
} # }