Learn R Programming

memisc (version 0.96-10)

query: Query an Object for Information

Description

The function query can be used to search an object for a keyword.

The data.set and importer methods perform such a search through the annotations and value labels of the items in the data set.

Usage

query(x,pattern,...)
## S3 method for class 'data.set':
query(x,pattern,\dots)
## S3 method for class 'importer':
query(x,pattern,\dots)

## S3 method for class 'item': query(x,pattern,\dots) # (Called by the methods above.)

Arguments

x
an object
pattern
a character string that gives the pattern to be searched for
...
optional arguments such as [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Value

  • If both the annotation and the value labels of an item match the pattern the query method for 'item' objects returns a list containing the annotation and the value labels, otherwise if only the annotation or the value labels match the pattern, either the annotation or the value labels are returned, otherwise if neither matches the pattern, query returns NULL.

    The methods of query for 'data.set' and 'importer' objects return a list of all non-NULL query results of all items contained by these objects, or NULL.

Examples

Run this code
nes1948.por <- UnZip("anes/NES1948.ZIP","NES1948.POR",
                     package="memisc")
nes1948 <- spss.portable.file(nes1948.por)
query(nes1948,"TRUMAN")

Run the code above in your browser using DataLab