search.for.regexpr {mvbutils} | R Documentation |
Find functions/objects/flatdoc-documentation containing a regexp.
Description
Search one or more environments for objects that contain a regexp. Within each environment, check either (i) all functions, or (ii) the "doc" attributes of all functions, plus any character objects whose name ends in ".doc" or matches a specified regexp.
Usage
search.for.regexpr( pattern, where=1, lines=FALSE, doc=FALSE, code.only=FALSE, ...)
Arguments
pattern |
the regexp |
where |
an environment, something that can be coerced to an environment (so the default corresponds to |
lines |
if FALSE, return names of objects mentioning the regexp. If TRUE, return the actual lines containing the regexp. |
doc |
if FALSE, search function source code only. Otherwise, search the usual |
code.only |
if FALSE, search only the deparsed version of "raw" code, so ignoring e.g. comments and "flatdoc" documentation |
... |
passed to |
Value
A list with one element per environment searched, containing either a vector of object names that mention the regexp, or a named list of objects & the actual lines mentioning the regexp.
See Also
flatdoc
, find.docholder
, find.documented
Examples
## Not run:
# On my own system's ROOT task (i.e. workspace--- see ?cd)
search.for.regexpr( 'author', doc=FALSE)
# $.GlobalEnv
# [1] "cleanup.refs"
# the code to function 'cleanup.refs' contains "author"
search.for.regexpr( 'author', doc=TRUE)
# $.GlobalEnv
# [1] "scrunge"
# 'scrunge' is a function with a character attribute that contains "author"
search.for.regexpr( 'author', doc='p')
#$.GlobalEnv
# [1] "scrunge" "p1" "p2"
## 'scrunge' again, plus two character vectors whose names contain 'p'
## End(Not run)