Search: Search Columns of a Data Frame

Description Usage Arguments Value Examples

Description

Find terms located in columns of a data frame.

Usage

1
2
  Search(dataframe, term, column.name = NULL,
    max.distance = 0.02, ...)

Arguments

dataframe

A dataframe object to search.

term

A character vector term to search for.

column.name

Optional column of the data frame to search (character name or integer index).

max.distance

Maximum distance allowed for a match. Expressed either as integer, or as a fraction of the pattern length times the maximal transformation cost (will be replaced by the smallest integer not less than the corresponding fraction).

...

Other arguments passed to agrep.

Value

Returns the rows of the data frame that match the search term.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(SampDF <- data.frame("islands"=names(islands)[1:32],mtcars))

Search(SampDF, "Cuba", "islands")
Search(SampDF, "New", "islands")
Search(SampDF, "Ho")
Search(SampDF, "Ho", max.distance = 0)
Search(SampDF, "Axel Heiberg")
Search(SampDF, 19) #too much tolerance in max.distance
Search(SampDF, 19, max.distance = 0)
Search(SampDF, 19, "qsec", max.distance = 0)

trinker/qdap2 documentation built on May 31, 2019, 9:47 p.m.