search for: concept_df

Displaying 4 results from an estimated 4 matches for "concept_df".

Did you mean: concept_
2017 Jul 01
0
How to replace match words whith colum name of data frame?
Dear ?, I'm sure that there are many ways to do what you want; here's one: > cbind(concept_df, category= + ifelse(apply( + sapply(chemical_df$chemical, + function(x) grepl(x, concept_df$concept)), + 1, any), + "chemical", "")) concept category 1 butan acid ch...
2017 Jul 01
0
How to replace match words whith colum name of data frame?
I have two data frame. I want to use "chemical_df" to match "concept_df " concept_df <- data.frame(concept=c("butan acid ", "nano diamond particl", "slurri composit", "composit ph polis", " inorgan particl ", "grind liquid", "liquid formul", "nanoparticl", "size abras partic...
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 concept match 1 butan acid chemical 2 nano diamond particl FALSE 3 slurri\ncomposit FALSE 4 composit ph polis chemical 5 inorgan particl...
2017 Aug 01
0
How to replace match words whith colum name of data frame?Hi--
Hi-- concept_df$NewCol <- ""; kw <- "acid|ph"; bb <- grepl(kw,concept_df$concept) concept_df[dd,2] <- "chemical" The is a bit late but it accomplish the same with base R. Good luck--EK PS.. my email doesn't accept reply [[alternative HTML version deleted]]