[ESS-bugs] Severe ESS R debug() problem: jumping from Browse[2] to Browse[32]

Martin Maechler maechler at stat.math.ethz.ch
Thu Aug 28 09:10:46 CEST 2014


This is not a new problem, I've seen it very occasionally only
and never had the patience to try making it reproducible,
but now I (think) I did.
The problem is not very new but still only about 1-2 years old,
I'm sure is somehow related to how ESS, ESSR and tracebug work.

You have to do it manually and with some patience... so this is
a somewhat long post.  But the problem is so severe when it happens
the exact behavior will depend a bit on your R search path [I
have two more packages in my default search(), one of which is
the "fortunes" package; but that is really not relevant],
maybe other things.  I gave a full *R* session below, and
summarize here:

If you use the traditional R way of debugging, i.e. you are in
the *R* buffer and do

   debug(<somefun>)

   <somefun>(..........)

you get the  famous  'Browse[2]> ' prompt:

Browse[2]> 

Now I go along, i.e. evaluate line by line by just pressing
[Enter] repeatedly.
Of course, I occasionally inspect some of the objects in the
function I am debugging, using str(), or just print()ing them.
Sometimes, quite rarely, the debugger seems to behave absolutely
crazy, suddently jumping from level 2 ("Browse[2]") debugging to
a high level, in the present example to level 32  (see below),
and I am suddenly inside a 32-step deep function call stack..
and do not get out easily, even when typing 'c' (+ [Enter])
instead of [Enter] alone.

This time, I was diagnosing an R bug, apparently in getAnywhere().
The problem happens -- only in ESS, I've tried outside ESS and
was not able to produce the same problem.

Also if I am in that bad situation and call
traceback() it tells me there is none; if I call
sys.frames() I see that the call stack is even larger: I see
75 environments (~= 2 * debug level !), just crazy.

The crucial function call (C-s for it below) 
which triggers all this behavior is

      identical(objs, c(list(), f))

with this excerpt from the session below

 Browse[2]> 
 debug: objs <- c(objs, f)
 Browse[2]> 
 debug: where <- c(where, paste("namespace", i, sep = ":"))
 Browse[2]> identical(objs, c(list(), f))
 Error in identical(objs, c(list(), f)) : object 'objs' not found
 Browse[32]> traceback()
 No traceback available 
 Browse[34]> 

Note that also the error is pretty special: How can 'objs' not
be found, as it was the R object, just manipulated one line
further up?  The answer must be that R at that point is already
into the (about 30-level deeply nested) function call sequence
where objs is out of visibility.

Here comes the session:

----------------------------

Starting R in ESS {with some private settings I'm sure should not matter}

> options(width=100, length=99999)
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
> debug(getAnywhere)
> getAnywhere("C_pbinom")
debugging in: getAnywhere("C_pbinom")
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[2]> 
debug: if (tryCatch(!is.character(x), error = function(e) TRUE)) x <- as.character(substitute(x))
Browse[2]> 
debug: objs <- list()
Browse[2]> 
debug: where <- character()
Browse[2]> 
debug: visible <- logical()
Browse[2]> 
debug: if (length(pos <- find(x, numeric = TRUE))) {
    objs <- lapply(pos, function(pos, x) get(x, pos = pos), x = x)
    where <- names(pos)
    visible <- rep.int(TRUE, length(pos))
}
Browse[2]> 
debug: if (length(grep(".", x, fixed = TRUE))) {
    np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
    for (i in 2:np) {
        gen <- paste(parts[1L:(i - 1)], collapse = ".")
        cl <- paste(parts[i:np], collapse = ".")
        if (gen == "" || cl == "") 
            next
        Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
            cl = cl))
        f <- eval.parent(Call)
        if (!is.null(f) && !is.null(environment(f))) {
            ev <- topenv(environment(f), baseenv())
            nmev <- if (isNamespace(ev)) 
                getNamespaceName(ev)
            else NULL
            objs <- c(objs, f)
            msg <- paste("registered S3 method for", gen)
            if (!is.null(nmev)) 
                msg <- paste(msg, "from namespace", nmev)
            where <- c(where, msg)
            visible <- c(visible, FALSE)
        }
    }
}
Browse[2]> 
debug: for (i in loadedNamespaces()) {
    ns <- asNamespace(i)
    if (exists(x, envir = ns, inherits = FALSE)) {
        f <- get(x, envir = ns, inherits = FALSE)
        objs <- c(objs, f)
        where <- c(where, paste("namespace", i, sep = ":"))
        visible <- c(visible, FALSE)
    }
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> i
[1] "compiler"
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: ns <- asNamespace(i)
Browse[2]> 
debug: if (exists(x, envir = ns, inherits = FALSE)) {
    f <- get(x, envir = ns, inherits = FALSE)
    objs <- c(objs, f)
    where <- c(where, paste("namespace", i, sep = ":"))
    visible <- c(visible, FALSE)
}
Browse[2]> 
debug: f <- get(x, envir = ns, inherits = FALSE)
Browse[2]> 
debug: objs <- c(objs, f)
Browse[2]> 
debug: where <- c(where, paste("namespace", i, sep = ":"))
Browse[2]> identical(objs, c(list(), f))
Error in identical(objs, c(list(), f)) : object 'objs' not found
Browse[32]> traceback()
No traceback available 
Browse[34]> 
debug: if (tryCatch(!is.character(x), error = function(e) TRUE)) x <- as.character(substitute(x))
Browse[34]> 
debug: objs <- list()
Browse[34]> 
debug: where <- character()
Browse[34]> 
debug: visible <- logical()
Browse[34]> 
debug: if (length(pos <- find(x, numeric = TRUE))) {
    objs <- lapply(pos, function(pos, x) get(x, pos = pos), x = x)
    where <- names(pos)
    visible <- rep.int(TRUE, length(pos))
}
Browse[34]> sys.frames()
[[1]]
<environment: 0x3b6cdc0>

[[2]]
<environment: 0x31414e0>

[[3]]
<environment: 0x2ec94d8>

[[4]]
<environment: 0x2ec99a8>

[[5]]
<environment: 0x2ec5478>

[[6]]
<environment: 0x2ec4b30>

[[7]]
<environment: 0x2c3ba60>

[[8]]
<environment: 0x2c3b000>

[[9]]
<environment: 0x2c25880>

[[10]]
<environment: 0x2c1d620>

[[11]]
<environment: 0x2dde260>

[[12]]
<environment: 0x2dded30>

[[13]]
<environment: 0x2ca60b0>

[[14]]
<environment: 0x2ca5ac8>

[[15]]
<environment: 0x2812978>

[[16]]
<environment: 0x2813448>

[[17]]
<environment: 0x2813ec0>

[[18]]
<environment: 0x2814840>

[[19]]
<environment: 0x28eafd0>

[[20]]
<environment: 0x28ebaa0>

[[21]]
<environment: 0x28ecd80>

[[22]]
<environment: 0x28ed738>

[[23]]
<environment: 0x2f364d0>

[[24]]
<environment: 0x2f36b40>

[[25]]
<environment: 0x2f3ab70>

[[26]]
<environment: 0x2f3ae60>

[[27]]
<environment: 0x2f7a8d0>

[[28]]
<environment: 0x2f7c240>

[[29]]
<environment: 0x2f80238>

[[30]]
<environment: 0x2f80640>

[[31]]
<environment: 0x2fa55e0>

[[32]]
<environment: 0x32240b8>

[[33]]
<environment: 0x3224c48>

[[34]]
<environment: 0x3225600>

[[35]]
<environment: 0x325ce88>

[[36]]
<environment: 0x325d990>

[[37]]
<environment: 0x325fc48>

[[38]]
<environment: 0x325f698>

[[39]]
<environment: 0x32882e8>

[[40]]
<environment: 0x3288db8>

[[41]]
<environment: 0x32898d8>

[[42]]
<environment: 0x328c838>

[[43]]
<environment: 0x32af908>

[[44]]
<environment: 0x32b0218>

[[45]]
<environment: 0x32b2b40>

[[46]]
<environment: 0x32d4090>

[[47]]
<environment: 0x330e208>

[[48]]
<environment: 0x330dcc8>

[[49]]
<environment: 0x330f668>

[[50]]
<environment: 0x3311840>

[[51]]
<environment: 0x34090c8>

[[52]]
<environment: 0x3409b28>

[[53]]
<environment: 0x340c7e8>

[[54]]
<environment: 0x3410be8>

[[55]]
<environment: 0x3447fe0>

[[56]]
<environment: 0x3452508>

[[57]]
<environment: 0x3453cf0>

[[58]]
<environment: 0x3453740>

[[59]]
<environment: 0x360aca8>

[[60]]
<environment: 0x360a810>

[[61]]
<environment: 0x3625520>

[[62]]
<environment: 0x36278b8>

[[63]]
<environment: 0x3682b90>

[[64]]
<environment: 0x3683510>

[[65]]
<environment: 0x3683fc0>

[[66]]
<environment: 0x2edfdc8>

[[67]]
<environment: 0x2e74bb0>

[[68]]
<environment: 0x2ca6008>

[[69]]
<environment: 0x2901eb0>

[[70]]
<environment: 0x2901a50>

[[71]]
<environment: 0x2902670>

[[72]]
<environment: 0x2904018>

[[73]]
<environment: 0x2904298>

[[74]]
<environment: 0x2904940>

[[75]]
<environment: 0x2908858>

Browse[36]> c
exiting from: getAnywhere(x)
[1] ""
Browse[34]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[34]> c
exiting from: getAnywhere(x)
(list "base" '(("x" . "NULL") ("max.lines" . "getOption(\"deparse.max.lines\")")) '("x" "max.lines"))
Browse[32]> 
debug: if (tryCatch(!is.character(x), error = function(e) TRUE)) x <- as.character(substitute(x))
Browse[32]> 
debug: objs <- list()
Browse[32]> 
debug: where <- character()
Browse[32]> 
debug: visible <- logical()
Browse[32]> 
debug: if (length(pos <- find(x, numeric = TRUE))) {
    objs <- lapply(pos, function(pos, x) get(x, pos = pos), x = x)
    where <- names(pos)
    visible <- rep.int(TRUE, length(pos))
}
Browse[32]> 
debug: if (length(grep(".", x, fixed = TRUE))) {
    np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
    for (i in 2:np) {
        gen <- paste(parts[1L:(i - 1)], collapse = ".")
        cl <- paste(parts[i:np], collapse = ".")
        if (gen == "" || cl == "") 
            next
        Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
            cl = cl))
        f <- eval.parent(Call)
        if (!is.null(f) && !is.null(environment(f))) {
            ev <- topenv(environment(f), baseenv())
            nmev <- if (isNamespace(ev)) 
                getNamespaceName(ev)
            else NULL
            objs <- c(objs, f)
            msg <- paste("registered S3 method for", gen)
            if (!is.null(nmev)) 
                msg <- paste(msg, "from namespace", nmev)
            where <- c(where, msg)
            visible <- c(visible, FALSE)
        }
    }
}
Browse[32]> 
debug: np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
Browse[32]> 
debug: for (i in 2:np) {
    gen <- paste(parts[1L:(i - 1)], collapse = ".")
    cl <- paste(parts[i:np], collapse = ".")
    if (gen == "" || cl == "") 
        next
    Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
        cl = cl))
    f <- eval.parent(Call)
    if (!is.null(f) && !is.null(environment(f))) {
        ev <- topenv(environment(f), baseenv())
        nmev <- if (isNamespace(ev)) 
            getNamespaceName(ev)
        else NULL
        objs <- c(objs, f)
        msg <- paste("registered S3 method for", gen)
        if (!is.null(nmev)) 
            msg <- paste(msg, "from namespace", nmev)
        where <- c(where, msg)
        visible <- c(visible, FALSE)
    }
}
Browse[32]> 
debug: gen <- paste(parts[1L:(i - 1)], collapse = ".")
Browse[32]> c
debug: for (i in loadedNamespaces()) {
    ns <- asNamespace(i)
    if (exists(x, envir = ns, inherits = FALSE)) {
        f <- get(x, envir = ns, inherits = FALSE)
        objs <- c(objs, f)
        where <- c(where, paste("namespace", i, sep = ":"))
        visible <- c(visible, FALSE)
    }
}
Browse[32]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[32]> c
exiting from: getAnywhere(x)
(list "base" '(("x" . "") ("y" . "") ("num.eq" . "TRUE") ("single.NA" . "TRUE") ("attrib.as.set" . "TRUE") ("ignore.bytecode" . "TRUE") ("ignore.environment" . "FALSE")) '("x" "y" "num.eq" "single.NA" "attrib.as.set" "ignore.bytecode" "ignore.environment"))
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[30]> c
exiting from: getAnywhere(x)
(list "" '(("..." . "") ("recursive" . "FALSE")) '("..." "recursive"))
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[28]> c
exiting from: getAnywhere(x)
(list "" '(("..." . "") ("recursive" . "FALSE")) '("..." "recursive"))
Browse[26]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[26]> c
exiting from: getAnywhere(x)
(list "" '(("..." . "")) '("..."))
Browse[24]> c
exiting from: getAnywhere(x)
debugging in: getAnywhere(x)
debug: {
    if (tryCatch(!is.character(x), error = function(e) TRUE)) 
        x <- as.character(substitute(x))
    objs <- list()
    where <- character()
    visible <- logical()
    if (length(pos <- find(x, numeric = TRUE))) {
        objs <- lapply(pos, function(pos, x) get(x, pos = pos), 
            x = x)
        where <- names(pos)
        visible <- rep.int(TRUE, length(pos))
    }
    if (length(grep(".", x, fixed = TRUE))) {
        np <- length(parts <- strsplit(x, ".", fixed = TRUE)[[1L]])
        for (i in 2:np) {
            gen <- paste(parts[1L:(i - 1)], collapse = ".")
            cl <- paste(parts[i:np], collapse = ".")
            if (gen == "" || cl == "") 
                next
            Call <- substitute(getS3method(gen, cl, TRUE), list(gen = gen, 
                cl = cl))
            f <- eval.parent(Call)
            if (!is.null(f) && !is.null(environment(f))) {
                ev <- topenv(environment(f), baseenv())
                nmev <- if (isNamespace(ev)) 
                  getNamespaceName(ev)
                else NULL
                objs <- c(objs, f)
                msg <- paste("registered S3 method for", gen)
                if (!is.null(nmev)) 
                  msg <- paste(msg, "from namespace", nmev)
                where <- c(where, msg)
                visible <- c(visible, FALSE)
            }
        }
    }
    for (i in loadedNamespaces()) {
        ns <- asNamespace(i)
        if (exists(x, envir = ns, inherits = FALSE)) {
            f <- get(x, envir = ns, inherits = FALSE)
            objs <- c(objs, f)
            where <- c(where, paste("namespace", i, sep = ":"))
            visible <- c(visible, FALSE)
        }
    }
    ln <- length(objs)
    dups <- rep.int(FALSE, ln)
    if (ln > 1L) 
        for (i in 2L:ln) for (j in 1L:(i - 1L)) if (identical(objs[[i]], 
            objs[[j]], ignore.environment = TRUE)) {
            dups[i] <- TRUE
            break
        }
    res <- list(name = x, objs = objs, where = where, visible = visible, 
        dups = dups)
    class(res) <- "getAnywhere"
    res
}
Browse[24]> Q
> 
   ## Phew!  Finally back to normal... !



More information about the ESS-bugs mailing list