similar to: str_count counts the substring

Displaying 20 results from an estimated 900 matches similar to: "str_count counts the substring"

2017 Sep 28
2
Searching for Enumerated Items using str_count() from the stringr package
Hi all, I have a large number of text strings to search for enumerated items. However, I am receiving this error message even though I thought that I properly escaped the special character closed parenthesis: > Count<-str_count(text3,keywords) Error in stri_count_regex(string, pattern, opts_regex = opts(pattern)) : Syntax error in regexp pattern. (U_REGEX_RULE_SYNTAX) === Here is
2017 Sep 28
0
Searching for Enumerated Items using str_count() from the stringr package
On 09/28/2017 10:25 PM, Dan Abner wrote: > Hi all, > > I have a large number of text strings to search for enumerated items. > However, I am receiving this error message even though I thought that I > properly escaped the special character closed parenthesis: > > >> Count<-str_count(text3,keywords) > Error in stri_count_regex(string, pattern, opts_regex =
2013 Feb 15
2
data formatting
Dear Eliza, Try this: Lines1<-readLines(textConnection("1911.01.01?????? 7.87 1911.01.02?????? 9.26 1911.01.03?????? 8.06 1911.01.04?????? 8.13 1911.01.05????? 12.90 1911.02.06?????? 5.45 1911.02.07?????? 3.26 1911.03.08?????? 5.70 1911.03.09?????? 9.24 1911.04.10?????? 7.60 1911.05.11????? 14.82 1911.05.12????? 14.10 1911.06.13?????? 7.87 1911.06.14?????? 9.26
2013 Sep 06
2
Alignment of data sets
Hi all; I have a data set with the format below: Year, Day, Hour, Value 2010, 001, 0, 15.9 2010, 001, 1, 7.3 2010, 001, 2, 5.2 2010, 001, 3, 8.0 2010, 001, 4, 0.0 2010, 001, 5, 12.1 2010, 001, 6, 11.6 2010, 001, 7, 13.9 2010, 001, 8, 11.9 2010, 001, 9, 13.6 2010, 001, 10, 16.1 2010, 001, 11, 18.5 That should
2013 Apr 10
2
grup function
Hello, How can i mattch blanks within words, when i have more phrases? c("Shangh i", "Hello here i am","h llo") > gsub(" ","a",c("Shangh i", "Hello here i am","h llo")) [1] "Shanghai" "Helloahereaiaam" "hallo" I would like to have [1] "Shanghai" "Hello here
2018 May 23
2
Pasar palabras de una lista a una variable del dataframe
Muchas gracias Carlos, Me da error al hacerlo. Mi variable donde quiero que localice las palabras de la lista tiene más de una palabra, no se si puede ser por eso. Gracias El Mar, 22 de Mayo de 2018, 20:15, Carlos Ortega escribió: > Hola, > > Aquí tienes un ejemplo (reproducible)... > > #----------------------- >> # Generar nombres de mujer >> library(randNames)
2018 Feb 07
4
Contar comas de una variable
Buenas tardes, Necesito contar cuántas comas hay en cada celda. Los datos tienen esta forma: Pros Comas Opinión 1 calidad, 1 Opinión 2 calidad, diseño, color, 3 Opinión 3 precio, accesibilidad, sienta bien, luminoso, 4 La variable Pros es la que tengo y la variable Comas es la
2019 Aug 15
4
Feature request: non-dropping regmatches/strextract
A very common use case for regmatches is to extract regex matches into a new column in a data.frame (or data.table, etc.) or otherwise use the extracted strings alongside the input. However, the default behavior is to drop empty matches, which results in mismatches in column length if reassignment is done without subsetting. For consistency with other R functions and compatibility with this use
2012 Aug 21
7
Regular Expressions in grep
Dear r-help members, I have a number in the form of a string, say: a<-"-01020.909200" I'd like to extract "1020." as well as ".9092" Front<-grep(pattern="[1-9]+[0-9]*\\.", value=TRUE, x=a, fixed=FALSE) End<-grep(pattern="\\.[0-9]*[1-9]+", value=TRUE, x=a, fixed=FALSE) However, both strings give "-01020.909200", exactly
2011 Jul 01
0
stringr 0.5
# stringr Strings are not glamorous, high-profile components of R, but they do play a big role in many data cleaning and preparations tasks. R provides a solid set of string operations, but because they have grown organically over time, they can be inconsistent and a little hard to learn. Additionally, they lag behind the string operations in other programming languages, so that some things that
2011 Jul 01
0
stringr 0.5
# stringr Strings are not glamorous, high-profile components of R, but they do play a big role in many data cleaning and preparations tasks. R provides a solid set of string operations, but because they have grown organically over time, they can be inconsistent and a little hard to learn. Additionally, they lag behind the string operations in other programming languages, so that some things that
2019 Sep 02
2
Feature request: non-dropping regmatches/strextract
I think that's a good reason for not including this in regmatches; you're right, its name is somewhat suggestive of yielding matches. Also, that sounds like a great design for strcapture with an atomic prototype. Best, CG
2018 Feb 15
2
Pasar una lista de palabras por una variable del dataframe
Hola, Tengo un grupo de 600 palabras que he recogido en una lista en R llamada "Atributos". Necesito saber cuántas veces cualquiera de esas palabras aparece en cada observación de la variable "Opinion" del dataframe "Datos", esta es una variable de texto. ¿Qué paquete se usaría? Gracias!
2013 Mar 14
3
Working with string
Hello again, Let say I have following string: Vec <- c("sada", "asdsa", "sa") Now I want to make each element of this vector with equal length. Basically I want following vector: c("sada ", "asdsa", "sa ") Therefore we can get: > nchar(c("sada ", "asdsa", "sa ")) [1] 5 5 5 Is there any
2012 Nov 02
2
backreferences in gregexpr
Hi Folks, I'm trying to extract just the backreferences from a regex. > temp = "abcd1234abcd1234" > regmatches(temp, gregexpr("(?:abcd)(1234)", temp)) [[1]] [1] "abcd1234" "abcd1234" What I would like is: [1] "1234" "1234" Note: I know I can just match 1234 here, but the actual example is complicated enough that I have to
2012 Sep 24
5
Memory usage in R grows considerably while calculating word frequencies
I am working with some large text files (up to 16 GBytes). I am interested in extracting the words and counting each time each word appears in the text. I have written a very simple R program by following some suggestions and examples I found online. If my input file is 1 GByte, I see that R uses up to 11 GBytes of memory when executing the program on a 64-bit system running CentOS 6.3. Why is
2012 Nov 16
1
Split data frame and create a new column
I need to split a data frame into 3 columns. The column I want to split contains indices of lag (prefix L1 or L2 and suffix 01, 03, 04), station name (shown in the sample data as capitalized G, P and S) and pollutant name. Names with no ?L? prefix or 01/04 suffix are lag 0. Lag 01 is average of lag 0 and 1, and 04 is average of 0 to 4 days. How can one do that in R? I will ignore the other
2019 Aug 29
2
Feature request: non-dropping regmatches/strextract
Thank you, I am aware that there are packages that can accomplish this. I mentioned stringr::str_extract as a function that does not drop empty matches. I think that the behavior of regmatches(..., regexpr(...))?in base R should permit an option to prevent dropping of empty matches both for sake of consistency with the rest of the language (missing data does not yield a dropped index in other
2011 Dec 01
2
Counting the occurences of a charater within a string
I am new to R but am experienced SAS user and I was hoping to get some help on counting the occurrences of a character within a string at a row level. My dataframe, x, is structured as below: Col1 abc/def ghi/jkl/mno I found this code on the board but it counts all occurrences of "/" in the dataframe. chr.pos <- which(unlist(strsplit(x,NULL))=='/') chr.count <-
2019 Aug 29
2
Feature request: non-dropping regmatches/strextract
Thank you! I greatly appreciate your consideration, though of course it is up to you. I think many people switch to stringr/stringi simply because functions in those packages have some consistent design choices, for example, they do not drop empty/missing matches, which facilitates array-based programming. For example, in the cases where one needs to make a new column in a data.frame (data.table,