Get dictionary matches of values in a vector
Arguments
- x
A vector, such as a column of character strings
- dictionary
A data frame with two or more columns, potentially made with
make_dictionary()
.- keep
The number of matched values to keep. If NULL, returns all matched values in a nested list.
See also
Other vectorized functions:
get_cumulative_vocabulary()
,
get_frequency()
,
get_hir()
,
get_htr()
,
get_idf_by()
,
get_sentiment()
,
get_tf_by()
,
get_tfidf_by()
,
get_ttr()
,
is_hapax()
,
is_new()
Examples
my_values <- c("It", "is", "raining")
emoji_weather <- make_dictionary(
list(
"️☔️" = c("rain", "rains", "rainy", "raining"),
"️⛈️" = c("storm", "storms", "stormy", "storming"),
"☁️" = c("cloud", "clouds", "cloudy"),
"🌞" = c("sun", "sunny"),
"🌫️" = c("fog", "fogs", "foggy", "mist", "misty"),
"🌬️" = c("wind", "winds", "windy"),
"️❄️" = c("snow", "snows", "snowing")),
name = "weather")
get_match(my_values, emoji_weather)
#> [1] NA NA "️☔️"