search for: str_which

Displaying 6 results from an estimated 6 matches for "str_which".

2017 Jul 11
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...would be too inefficient to handle that volume of data. Thanks, Paul library(tidyverse) library(stringr) library(lubridate) sentence_match <- function(x){ sentence_extract <- str_extract_all(sampletxt, boundary("sentence"), simplify = TRUE) sentence_number <- intersect(str_which(sentence_extract, "breast"), str_which(sentence_extract, "metastatic|stage IV")) sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_number], collapse = "") sentence_match } #### Working code #### sampletxt <- "This sen...
2017 Jul 12
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...data. > >Thanks, > >Paul > > >library(tidyverse) >library(stringr) >library(lubridate) > >sentence_match <- function(x){ > sentence_extract <- str_extract_all(sampletxt, boundary("sentence"), simplify = TRUE) > sentence_number <- intersect(str_which(sentence_ extract, "breast"), str_which(sentence_extract, "metastatic|stage IV")) > sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_ number], collapse = "") > sentence_match >} > >#### Working code #### > >sa...
2017 Jul 12
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...data. > >Thanks, > >Paul > > >library(tidyverse) >library(stringr) >library(lubridate) > >sentence_match <- function(x){ > sentence_extract <- str_extract_all(sampletxt, boundary("sentence"), simplify = TRUE) > sentence_number <- intersect(str_which(sentence_ extract, "breast"), str_which(sentence_extract, "metastatic|stage IV")) > sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_ number], collapse = "") > sentence_match >} > >#### Working code #### > >sa...
2017 Jul 13
1
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...s through the data like my code does, how would you go about it? Thanks, Paul library(tidyverse) library(stringr) library(lubridate) sentence_match <- function(x){ sentence_extract <- str_extract_all(x, boundary("sentence"), simplify = TRUE) sentence_number <- intersect(str_which(sentence_extract, "breast"), str_which(sentence_extract, "metastatic|stage IV")) sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_number], collapse = "") sentence_match } sampletxt <- structure( list( PTNO = c(1...
2017 Jul 11
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...t; Thanks, > > Paul > > > library(tidyverse) > library(stringr) > library(lubridate) > > sentence_match <- function(x){ > sentence_extract <- str_extract_all(sampletxt, boundary("sentence"), > simplify = TRUE) > sentence_number <- intersect(str_which(sentence_extract, "breast"), > str_which(sentence_extract, "metastatic|stage IV")) > sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_number], > collapse = "") > sentence_match > } > > #### Working code ####...
2017 Jul 13
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...s through the data like my code does, how would you go about it? Thanks, Paul library(tidyverse) library(stringr) library(lubridate) sentence_match <- function(x){ sentence_extract <- str_extract_all(x, boundary("sentence"), simplify = TRUE) sentence_number <- intersect(str_which(sentence_extract, "breast"), str_which(sentence_extract, "metastatic|stage IV")) sentence_match <- str_c(sentence_number, ": ", sentence_extract[sentence_number], collapse = "") sentence_match } sampletxt <- structure( list( PTNO = c(1...