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 pipe style
require(purrr)
require(stringr)
map(dat$pattern, ~str_detect(dat$words, .))
I tried to think how
dat %>% map(.$pattern, ~str_detect, string=.$words)
dat %>% lmap(.$pattern, ~str_detect, string=.$words)
But I could not get the result that I want. Any ideas?
source
share