The R Project SVN R

Rev

Rev 71268 | Rev 82647 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71268 Rev 71282
Line 11... Line 11...
11
find(what, mode = "any", numeric = FALSE, simple.words = TRUE)
11
find(what, mode = "any", numeric = FALSE, simple.words = TRUE)
12
}
12
}
13
\alias{apropos}
13
\alias{apropos}
14
\alias{find}
14
\alias{find}
15
\arguments{
15
\arguments{
16
  \item{what}{character string with name of an object, or more generally
16
  \item{what}{character string.  For \code{simple.words = FALSE}
-
 
17
    the name of an object; otherwise
17
    a \link{regular expression} to match against.}
18
    a \link{regular expression} to match object names against.}
18
  \item{where, numeric}{a logical indicating whether positions in the
19
  \item{where, numeric}{a logical indicating whether positions in the
19
    search list should also be returned}
20
    search list should also be returned}
20
  \item{ignore.case}{logical indicating if the search should be
21
  \item{ignore.case}{logical indicating if the search should be
21
    case-insensitive, \code{TRUE} by default.}
22
    case-insensitive, \code{TRUE} by default.}
22
  \item{mode}{character; if not \code{"any"}, only objects whose
23
  \item{mode}{character; if not \code{"any"}, only objects whose
23
    \code{\link{mode}} equals \code{mode} are searched.}
24
    \code{\link{mode}} equals \code{mode} are searched.}
24
  \item{simple.words}{logical; if \code{TRUE}, the \code{what} argument is
25
  \item{simple.words}{logical; if \code{TRUE}, the \code{what} argument is
25
    only searched as whole word.}
26
    only searched as a whole word.}
26
}
27
}
27
\description{
28
\description{
28
  \code{apropos()} returns a character vector giving the names of
29
  \code{apropos()} returns a character vector giving the names of
29
  all objects in the search list matching \code{what}.
30
  objects in the search list matching (as a regular expression)
-
 
31
  \code{what}.
30
 
32
 
31
  \code{find()} is a different user interface to the same task.
33
  \code{find()} returns where objects of a given name can be found.
32
}
34
}
33
\details{
35
\details{
34
  If \code{mode != "any"} only those objects which are of mode \code{mode}
36
  If \code{mode != "any"} only those objects which are of mode \code{mode}
35
  are considered.
37
  are considered.
36
 
38
 
37
  \code{find} is a different user interface for the same task as
39
  \code{find} is a different user interface for a similar task to
38
  \code{apropos}. However, by default (\code{simple.words == TRUE}),
40
  \code{apropos}. By default (\code{simple.words == TRUE}),
39
  only full words are searched with \code{\link{grep}(fixed = TRUE)}.
41
  only whole names are matched. Unlike \code{apropos}, matching is
-
 
42
  always case-sensitive.
-
 
43
 
-
 
44
  Unlike the default behaviour of \code{\link{ls}}, names which
-
 
45
  begin with a \samp{.} are included (and these are often
-
 
46
  \sQuote{internal} objects --- as from \R 3.4.0 most such are excluded).
40
}
47
}
41
\author{Originally, Kurt Hornik and Martin Maechler (May 1997).}
48
\author{Originally, Kurt Hornik and Martin Maechler (May 1997).}
42
\value{
49
\value{
43
  For \code{apropos} a character vector, sorted by name, for \code{where
50
  For \code{apropos}, a character vector sorted by name.  For
44
  = TRUE} with names giving the (numerical) positions on the search
51
  \code{where = TRUE} this has names giving the (numerical) positions on
45
  path.  Unlike the default behaviour of \code{\link{ls}}, names which
-
 
46
  begin with a \samp{.} are included (and these are often
-
 
47
  \sQuote{internal} objects).
52
  the search path.
48
 
53
 
49
  For \code{find}, either a character vector of environment names, or for
54
  For \code{find}, either a character vector of environment names or
50
  \code{numeric = TRUE}, a numerical vector of positions on the search path,
55
  (for \code{numeric = TRUE}) a numerical vector of positions on the
51
  with names giving the names of the corresponding environments.
56
  search path with names the names of the corresponding environments.
52
}
57
}
53
\seealso{
58
\seealso{
54
  \code{\link{glob2rx}} to convert wildcard patterns to regular expressions.
59
  \code{\link{glob2rx}} to convert wildcard patterns to regular expressions.
55
 
60
 
56
  \code{\link{objects}} for listing objects from one place,
61
  \code{\link{objects}} for listing objects from one place,
Line 60... Line 65...
60
\examples{
65
\examples{
61
require(stats)
66
require(stats)
62
 
67
 
63
%% some of these have enormous output that varies a lot by version
68
%% some of these have enormous output that varies a lot by version
64
\dontrun{apropos("lm")}
69
\dontrun{apropos("lm")}
65
apropos("GLM")                      # more than a dozen
70
apropos("GLM")                      # several
66
## that may include internal objects starting '.__C__' if
-
 
67
## methods is attached
-
 
68
apropos("GLM", ignore.case = FALSE) # not one
71
apropos("GLM", ignore.case = FALSE) # not one
69
apropos("lq")
72
apropos("lq")
70
 
73
 
71
cor <- 1:pi
74
cor <- 1:pi
72
find("cor")                         #> ".GlobalEnv"   "package:stats"
75
find("cor")                         #> ".GlobalEnv"   "package:stats"