Try the stringr package.

This should work

chemical=c("basic", "alkalin", "alkali", "acid",  " ph ", "hss")
chemical_match <- str_c(chemical, collapse = "|")
chemical_match

concept_df$match[str_detect(concept_df$concept, chemical_match)] <-
"chemical"
concept_df

> concept_df
                concept    match
1           butan acid  chemical
2  nano diamond particl    FALSE
3      slurri\ncomposit    FALSE
4     composit ph polis chemical
5      inorgan particl     FALSE
6          grind liquid    FALSE
7         liquid formul    FALSE
8           nanoparticl    FALSE
9    size abras particl    FALSE
10     agent malic acid chemical


-- 


*Abraham MathewData Ninja and Statistical Modeler*



*Minneapolis, MN720-648-0108@abmathewksAnalytics_Blog
<https://mathewanalytics.wordpress.com/>*

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to