Debian Codegraph @

man/query.Rd

raw
1 \name{query}
2 \alias{query}
3 \alias{query,data.set-method}
4 \alias{query,importer-method}
5 \alias{query,item-method}
6
7 \title{Query an Object for Information}
8
9 \description{
10 The function \code{query} can be used to search an object
11 for a keyword.
12
13 The \code{\link{data.set}} and \code{\link{importer}} methods perform such a search
14 through the annotations and value labels of
15 the items in the data set.
16 }
17 \usage{
18 query(x,pattern,\dots)
19 \S4method{query}{data.set}(x,pattern,\dots)
20 \S4method{query}{importer}(x,pattern,\dots)
21
22 \S4method{query}{item}(x,pattern,\dots)
23 # (Called by the methods above.)
24 }
25 \arguments{
26 \item{x}{an object}
27 \item{pattern}{a character string that gives the pattern to be searched
28 for}
29 \item{\dots}{optional arguments such as
30 \describe{
31 \item{\code{fuzzy}}{logical, TRUE by default; use fuzzy search via \code{\link{agrep}} or regexp search
32 via \code{\link{grep}} }
33 \item{\code{extended}}{logical, defaults to FALSE; passed to \code{\link{grep}} }
34 \item{\code{perl}}{logical, defaults to TRUE; passed to \code{\link{grep}} }
35 \item{\code{fixed}}{logical, defaults to TRUE; passed to \code{\link{grep}} }
36 \item{\code{ignore.case}}{logical, defaults to TRUE; passed to \code{\link{grep}} or \code{\link{agrep}}}
37 \item{\code{insertions}}{numerical value, defaults
38 to 0.999999999; passed to \code{\link{agrep}} }
39 \item{\code{deletions}}{numerical value, defaults to 0; passed to \code{\link{agrep}} }
40 \item{\code{substitutions}}{numerical value, defaults to 0; passed to \code{\link{agrep}} }
41 }
42 }
43 }
44 \value{
45 If both the annotation and the value labels of an item match the pattern
46 the \code{query} method for 'item' objects returns a list containing the annotation
47 and the value labels, otherwise if only the annotation or the value labels
48 match the pattern, either the annotation or the value labels are returned,
49 otherwise if neither matches the pattern, \code{query} returns \code{NULL}.
50
51 The methods of \code{query} for 'data.set' and 'importer' objects return
52 a list of all non-\code{NULL} query results of all items contained by these
53 objects, or \code{NULL}.
54 }
55 \examples{
56 nes1948.por <- unzip(system.file("anes/NES1948.ZIP",package="memisc"),
57 "NES1948.POR",exdir=tempfile())
58 nes1948 <- spss.portable.file(nes1948.por)
59 query(nes1948,"TRUMAN")
60 }
61
62 \keyword{manip}