Learn R Programming

textTools (version 0.1.0)

str_weighted_count_match: Weighted count of the words in a vector that are found in another vector.

Description

Weighted count of the words in a vector that are found in another vector.

Usage

str_weighted_count_match(x, y)

Arguments

x

A list of words and counts created by str_counts(x).

y

A list of words and counts created by str_counts(y).

Value

A number, the count of words in x also in y scaled by the number of times each word appears in x and y. If a word appears 3 times in x and 2 times in y, the result is 6, assuming no other words match.

Examples

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

Run the code above in your browser using DataLab