Displaying 3 results from an estimated 3 matches for "alkali".
Did you mean:
alkalin
2017 Jul 01
0
How to replace match words whith colum name of data frame?
..."slurri
composit", "composit ph polis", " inorgan particl ", "grind liquid", "liquid formul", "nanoparticl", "size abras particl", "agent malic acid"))
chemical_df <- data.frame(chemical=c("basic", "alkalin", "alkali", "acid", " ph ", "hss"))
Here is my match code:
library(magrittr)
match_df <- NULL
for (i in 1:length(chemical_df$chemical)) {
match_df<-data.frame(category=concept_df[grep(chemical_df$chemical[i], concept_df$concept), ] ) %>%
rbi...
2017 Jul 30
0
How to replace match words whith colum name of data frame?
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
co...
2017 Jul 01
0
How to replace match words whith colum name of data frame?
...sit", "composit ph polis", " inorgan particl ",
> "grind liquid", "liquid formul", "nanoparticl", "size abras particl",
> "agent malic acid"))
>
> chemical_df <- data.frame(chemical=c("basic", "alkalin", "alkali",
> "acid", " ph ", "hss"))
>
> Here is my match code:
>
> library(magrittr)
> match_df <- NULL
> for (i in 1:length(chemical_df$chemical)) { match_df<-
> data.frame(category=concept_df[grep(chemical_df$chemica...