Learn R Programming

textTools (version 0.1.0)

str_count_match: Count the words in a vector that are found in another vector.

Description

Count the words in a vector that are found in another vector.

Usage

str_count_match(x, y, ratio = FALSE)

Arguments

x

A vector of words.

y

A vector of words to test against.

ratio

TRUE/FALSE, if TRUE, returns the number of words in x with a match in y divided by the number of words in x.

Value

A number, the count of words in x also in y

Examples

Run this code
# NOT RUN {
str_count_match(
x = c("a", "dog", "went", "to", "the", "store"),
y = c("dog", "to", "store")
)
str_count_match(
x = c("a", "dog", "went", "to", "the", "store"),
y = c("dog", "to", "store"),
ratio = TRUE
)
# }

Run the code above in your browser using DataLab