stringin: Find a String in a Character Vector

Description Usage Arguments Value See Also Examples

View source: R/stringin.R

Description

Find a string in a character vector.

Usage

1
stringin(pattern, x, ignore.case = TRUE, value = TRUE, fixed = TRUE, ...)

Arguments

pattern

Character scalar, string to be matched in x.

x

Character vector where matches are sought.

ignore.case

Logical scalar, indicating case sensitivity, default TRUE.

value

Logical scalar, indicating whether to return the matching elements (the default, TRUE) or their indices (FALSE).

fixed

Logical scalar, indicating whether string should be matched as is, default TRUE.

...

Other arguments to grep.

Value

Character vector containing the matching elements of x.

See Also

grep.

Examples

1
2
3
4
5
6
7
8
txt <- c("The", "licenses", "for", "most", "software", "are", "designed",
 "to", "take", "away", "your", "freedom", "to", "share", "and", "change",
 "it.", "", "By", "contrast,", "the", "GNU", "General", "Public", "License",
 "is", "intended", "to", "guarantee", "your", "freedom", "to", "share", "and",
 "change", "free", "software", "--", "to", "make", "sure", "the", "software",
 "is", "free", "for", "all", "its", "users.")
stringin("b", txt)
stringin("ar", txt)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.