I was having a hard time finding the all.vars function (and wound up
creating a poor man's version -- see below). I see that there are links to
all.vars in the stats/man/case.names.Rd and stats/man/formula.Rd. I was
wondering if more crosslinks could be made for this function, particularly
in base/man/substitute.Rd. Also base/man/allnames.Rd does not contain a link
with any other man page and so perhaps it can return the favor to
substitute.

Cheers,
Patrick


poorMansAllVars <- function(expr = expression(), vars = character())
{
    ## kludge to ignore function symbols by naming all functions "..__.."
    expr <- substitute(expr)
    if (typeof(expr) != "language")
        stop("'expr' should be typeof \"language\"")
    expr <-
      parse(text =
            paste(gsub("\\w*\\(", "..__..\\(", deparse(expr)),
                  collapse = " "))
    if (length(expr) > 0L)
        expr <- expr[[1L]]
    ## end kludge
    boundEnv <- new.env(hash = TRUE, parent = emptyenv())
    foundEnv <- new.env(hash = TRUE, parent = emptyenv())
    lapply(vars,
           function(object)
           {
               found <- function() {assign(object, TRUE, envir = foundEnv)}
               makeActiveBinding(object, found, boundEnv)
           })
    do.call(substitute, list(expr, boundEnv))
    ls(foundEnv, all.names = TRUE)
}



Patrick

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to