lookfor: Look for something somewhere

Description Usage Arguments Details Value Author(s) Examples

View source: R/lookfor.R

Description

Look for something in an object or anywhere in the active workspace

Usage

1
2
lookfor(what, ls_opts = list(name = ".GlobalEnv"), ...)
lookin(x, what, ...)

Arguments

x

An object to look in.

what

What to look for: either a character string or a regular expression.

ls_opts

A list of optional arguments passed ls. This can be used to look in an environment other than .GlobalEnv.

...

Additional arguments passed to methods, and eventually passed to grepl.

Details

Find something you're looking for in a specified object, or anywhere in the active workspace.

Value

An object of class “lookfor” or “lookin”.

Author(s)

Thomas J. Leeper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require("datasets")

# look in a data.frame
data(USArrests)
## look for observation
lookin(USArrests, "Alaska")
## look for variable
lookin(USArrests, "Assault")

# look in an environment
x <- new.env()
x$mtcars <- mtcars
x$cars <- letters[1:10]
x$cards <- 1:5
lookin(x, "car")

# look in a list
data(mtcars)
x <- structure(mtcars, class = "list")
lookin(x, "mpg")

# look everywhere
lookfor("package")

# use regular expressions
## Look for car names containing letters and numbers (anywhere)
lookfor("[[:alpha:]]+ [[:digit:]]")
## Look for car names containing letters and numbers (in mtcars)
lookin(mtcars, "[[:alpha:]]+ [[:digit:]]")

leeper/lookfor documentation built on May 21, 2019, 12:37 a.m.