search for: str_extract_all

Displaying 20 results from an estimated 21 matches for "str_extract_all".

2012 May 08
1
Extracting Hash-tagged word from Tweets
...London 2012 http://t.co/XsvvXAzT #london2012 #olympics #sport @hollandtrade @dutchembassyUK" (Tweet download) I want a code that will extract this: #Dutch companies #london2012, #olympics, #sport I have used the under-listed code in Stringr which return these outputs I did not require: > str_extract_all("#<-a-z, #<-A-Z", "[[string1:string10]]") [[1]] character(0) > str_extract_all("#<-a-z, #<-A-Z", "[[string9]]") [[1]] character(0) > str_extract_all("#=[1:10]", "#+a-z") [[1]] character(0) str_extract_all("#=[1:10]...
2016 Apr 18
3
Sum of Numeric Values in a DF Column
..." )), .Names = c("State", "Lower", "Upper"), row.names = c(NA, 5L), class = "data.frame") PROBLEM: Need to extract all numeric values and sum them. There are few exceptions like row2. But these can be ignored and will be fixed manually SOLUTION SO FAR: str_extract_all(dd[[2]],"[[:digit:]]+"), returns a list of numbers as character. I am unable to unlist it, because it mixes them all together, ... And if I may add, is there a "dplyr" way of doing it ... Thanks [[alternative HTML version deleted]]
2013 Jun 16
2
extract all numbers from a string
Hi all, I have been beating my head against this problem for a bit, but I can't figure it out. I have a series of strings of variable length, and each will have one or more numbers, of varying format. E.g., I might have: tmpstr = "The first number is: 32. Another one is: 32.1. Here's a number in scientific format, 0.3523e10, and another, 0.3523e-10, and a negative,
2016 Apr 18
2
Sum of Numeric Values in a DF Column
...nd is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Apr 18, 2016 at 10:07 AM, Richard M. Heiberger <rmh at temple.edu> wrote: > ## Continuing with your data > > AA <- stringr::str_extract_all(dd[[2]],"[[:digit:]]+") > BB <- lapply(AA, as.numeric) > ## I think you are looking for one of the following two expressions > sum(unlist(BB)) > sapply(BB, sum) > > > On Mon, Apr 18, 2016 at 12:48 PM, Burhan ul haq <ulhaqz at gmail.com> wrote: >> Hi, &g...
2016 Apr 18
0
Sum of Numeric Values in a DF Column
## Continuing with your data AA <- stringr::str_extract_all(dd[[2]],"[[:digit:]]+") BB <- lapply(AA, as.numeric) ## I think you are looking for one of the following two expressions sum(unlist(BB)) sapply(BB, sum) On Mon, Apr 18, 2016 at 12:48 PM, Burhan ul haq <ulhaqz at gmail.com> wrote: > Hi, > > I request help with the follo...
2013 Nov 06
1
Multiple String word replacements: Performance Issue
...y,pattern=tolower(rep_ticker)) first<-do.call(str_match,arguments) # Identify signal words and count them # Need to be done in parts, because otherwise R can't handle this many at once arguments<-list(string=x, pattern=rep_words_part1) t1<-do.call(str_extract_all,arguments) arguments<-list(string=x, pattern=rep_words_part2) t2<-do.call(str_extract_all,arguments) arguments<-list(string=x, pattern=rep_words_part3) t3<-do.call(str_extract_all,arguments) arguments<-list(string=x, pattern=rep_words_p...
2016 Apr 18
0
Sum of Numeric Values in a DF Column
...> and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, Apr 18, 2016 at 10:07 AM, Richard M. Heiberger <rmh at temple.edu> wrote: >> ## Continuing with your data >> >> AA <- stringr::str_extract_all(dd[[2]],"[[:digit:]]+") >> BB <- lapply(AA, as.numeric) >> ## I think you are looking for one of the following two expressions >> sum(unlist(BB)) >> sapply(BB, sum) >> >> >> On Mon, Apr 18, 2016 at 12:48 PM, Burhan ul haq <ulhaqz at gmail.co...
2012 May 22
1
Problem with Extracting Hash Tagged Words from Tweets
Hello All, Can anyone help me solve this problem. Am trying to extract hash-tagged words from tweets downloaded from twitteR. I can extract hash-tagged words from single tweet using (stringr) str_extract_all(tweets, "#[a-z//A-Z//0-9]+")  but cannot with more than one tweet at a time except I manually remove all regular expressions and tweets numbers such as [[1]] and [1.] I want to automatically extract all #words in large number of tweets at a go. This is what I have done so far by removing...
2019 Sep 23
5
Consulta
...obertura[1],pattern = "[0-9]{1,}"))? if (length(sumacob)==0){? sumacob = NA? }? ? sumaext<-as.numeric(str_extract(extranjera[17],pattern = "[0-9]{1,}"))? if (length(sumaext)==0){? sumaext = NA? }? valores <- NULL? monedas <- NULL? valores <- str_extract_all(suma_str[17],pattern = "[0-9]{0,3},*[0-9]{0,3},*[0-9]{1,3}(.[0-9]{1,}){0,1}",simplify=TRUE)? monedas <- str_extract(suma_str,pattern = mon_rg)? if (length(valores[1])==0){? suma = NA? mon = NA? }else{? suma = as.numeric(gsub(pattern = ",*",replacement = &quo...
2017 Jul 11
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...ntence, but many have several paragraphs. One concern I had was that, even if I could get my code working, it 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...
2017 Jul 12
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...concern I had was that, even if I could get my code working, it 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[senten...
2017 Jul 12
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...concern I had was that, even if I could get my code working, it 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[senten...
2017 Jul 13
1
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...ing would be lost. If you were going to get the sentence numbers as well, without making several passes 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], colla...
2019 Sep 24
2
Consulta
...)? > if (length(sumacob)==0){? > sumacob = NA? > }? > ? > sumaext<-as.numeric(str_extract(extranjera[17],pattern = "[0-9]{1,}"))? > if (length(sumaext)==0){? > sumaext = NA? > }? > valores <- NULL? > monedas <- NULL? > valores <- str_extract_all(suma_str[17],pattern = "[0-9]{0,3},*[0-9]{0,3},*[0-9]{1,3}(.[0-9]{1,}){0,1}",simplify=TRUE)? > monedas <- str_extract(suma_str,pattern = mon_rg)? > if (length(valores[1])==0){? > suma = NA? > mon = NA? > }else{? > suma = as.numeric(gsub(pattern = ",*&...
2017 Jul 11
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...that, even if I > could get my code working, it 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_ext...
2010 Mar 31
3
regular expression help to extract specific strings from text
Dear all, Lets say I have the following: > x <- c("Eve: Going to try something new today...", "Adam: Hey @Eve, how are you finding R? #rstats", "Eve: @Adam, It's awesome, so much better at statistics that #Excel ever was! @Cain & @Able disagree though :(", "Adam: @Eve I'm sure they'll sort it out :)", "blahblah") > x [1]
2017 Jul 13
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
...ing would be lost. If you were going to get the sentence numbers as well, without making several passes 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], colla...
2012 Apr 24
2
searchina a pattern in a string
I have a long string. i want to sepearate a 10 digit phone no from it. eg "my no is 9876543210 is personal no and my official no is 123-456-8907. you can use any of these" i want to seperate the 9876543210 and 123-456-8907 from this. therev may be many phone nos in the string. how to do it ----- Thanks in Advance Arun -- View this message in context:
2013 Jul 02
2
Replacing strings to numbers
Hi guys, I was wondering if any one is able to help me on a problem that I was stuck with for a long time. It involves the replacement of character strings with numbers. The character string can take on only 3 possible values, for instance: AA AT TT I would want R to replace AT with 0. Between AA and TT, I want to compare the frequency of either value, and then for the one which occurs more, I
2013 Mar 13
5
string split at xth position
Hi, I have a vector of strings like: c("a1b1","a2b2","a1b2") which I want to spilt into two parts like: c("a1","a2","a2") and c("b1","b2,"b2"). So there is always a first part with a+number and a second part with b+number. Unfortunately there is no separator I could use to directly split the vectors.. Any idea