string_occurs: Find Strings in Text

View source: R/string_occurs.R

string_occursR Documentation

Find Strings in Text

Description

This function searches for text within one or more phrases. Text to look for will be grouped into values that are found and not found.

Usage

string_occurs(dict_list, haystack, ignore.case = TRUE, nClust = 2)

Arguments

dict_list

character vector; value(s) to find

haystack

character vector; phrase(s) where values may exist

ignore.case

logical; indicates if spelling case matters, defaulting to ‘TRUE’

nClust

Number of CPU cores to use, if available. This requires the ‘parallel’ package.

Value

list with two elements, ‘TRUE’ and ‘FALSE’, representing values that are found or not found within the phrase to search.

Examples

note1 <- "I am the very model of a modern major general
I've information vegetable, animal, and mineral
I know the kings of England, and I quote the fights historical
From marathon to Waterloo in order categorical;
I'm very well acquainted, too, with matters mathematical,
I understand equations both the simple and quadratical
About binomial theorem I'm teeming with a lot o' news,
With many cheerful facts about the square of the hypotenuse"
note2 <- "The quick brown fox jumps over the lazy dog"
string_occurs(c('kings','quick','couth','brown'), c(note1, note2))

medExtractR documentation built on June 7, 2022, 1:08 a.m.