which.term {JATSdecoder}R Documentation

which.term

Description

Returns search element/s from vector that is/are present in text or returns search term hit vector for all terms.

Usage

which.term(x, terms, tolower = TRUE, hits_only = FALSE)

Arguments

x

text string to process.

terms

search term vector.

tolower

Logical. If TRUE converts search terms and text to lower case.

hits_only

Logical. If TRUE returns search pattern/s, that were found in text and not a search term hit vector.

Value

Binary hit vector with search term named elements if hits_only=FALSE.

Character vector with identified search term elements if hits_only=TRUE.

Examples

text<-c("This demo demonstrates how which.term works.",
       "The result is a simple 0, 1 coded vector for all search patterns or 
        a vector including the identified patterns only.")
which.term(text,c("Demo","example","work"))
which.term(text,c("Demo","example","work"),tolower=TRUE,hits_only=TRUE)

[Package JATSdecoder version 1.2.0 Index]