Having the following list:
dat <- list(words = c("foo", "bar", "howdy"),
pattern=c(foobar="foo|bar", cowboy="howdy"),
furterdat=1)
I would like to do the following in a pipe-style way
require(purrr)
require(stringr)
map(dat$pattern, ~str_detect(dat$words, .))
I tried thinks like
dat %>% map(.$pattern, ~str_detect, string=.$words)
dat %>% lmap(.$pattern, ~str_detect, string=.$words)
But couldn't get the result i want. Any ideas?
stringi(the underpinning ofstringr) is vectorized over bothstrandpatternif that helps at al. - hrbrmstrstr_detect(dat$words, dat$pattern)is not what i am looking for. - Rentrop