Learn R Programming

tm (version 0.5-10)

sFilter: Statement Filter

Description

Filter meta data by user-defined statements.

Usage

sFilter(x, s)

Arguments

x
A Corpus.
s
A statement of format "tag1 == 'expr1' & tag2 == 'expr2' & ...".

Value

  • A logical vector to represent the subset of the DMetaData (extended for shifted up variables) data frame as specified by the statement.

Details

The statement s models a simple query language. It consists of an expression as passed over to a data frame for subsetting. Tags in s represent meta data variables. Variables only available at document level are shifted up to the data frame if necessary. Note that the meta data tags for the slots Author, DateTimeStamp, Description, ID, Origin and Heading are author, datetimestamp, description, id, origin and heading, respectively, to avoid name conflicts.

Examples

Run this code
data("crude")
sFilter(crude, "id == '127' & heading == 'DIAMOND SHAMROCK (DIA) CUTS CRUDE PRICES'")
sFilter(crude, "Places == 'usa'")

Run the code above in your browser using DataLab