Skip to content
Prev 377037 / 398502 Next

Matching multiple search criteria (Unlisting a nested dataset, take 2)

Here is another approach, just for fun:

library(tidyverse)
library(tokenizers)

anyall <- function(x, # a character vector
                   terms # a list of character vectors
                   ){
    any(map_lgl(terms, function(term) {
        all(term %in% x)
    }))
}

mutate(th,
       flag = map_lgl(tokenize_tweets(text),
                      anyall,
                      terms = tokenize_words(st$terms)))

Best,
Ista
On Tue, Oct 16, 2018 at 5:39 PM Nathan Parsons
<nathan.f.parsons at gmail.com> wrote: