similar to: backreferences in gregexpr

Displaying 20 results from an estimated 800 matches similar to: "backreferences in gregexpr"

2007 Mar 08
2
Named backreferences in replacement patterns
Hi I have a problem with substitutions involving named backreferences. I have a vector American.dates: > American.dates [1] "5/15/1976" "2.15.1970" "1.9.2006" which I want to change into British.dates: > British.dates [1] "15/5/1976" "15/2/1970" "9/1/2006" I know I can do it like this:
2012 Apr 26
2
Using backreferences from node name regex match
I appears that backreferences when using regexes in node names doesn''t work. Can anyone confirm this? If I''m incorrect, how do I go about using a backreference to the name regex within the node definition container? Thanks, Guy -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web
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 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
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
2014 Jun 24
3
winbind: homeDirectory being ignored
Something strange here. User created using: root at dc1:~# samba-tool user add user7 Abcd1234 --uid-number=1007 --home-directory=/home/user7 --login-shell=/bin/bash User 'user7' created successfully I can see the homeDirectory attribute in the entry. But the home directory that winbind returns is just the template one: root at adclient:~# getent passwd user7
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
2009 Oct 03
1
Named backreference in gsub()?
Hi, I'm running out of the *numbered* backreferences \\1, \\2, ..., \\9 for gsub(). Does R support *named* backreferences, and if so, what is the syntax? Thanks Henrik
2019 Aug 15
1
Feature request: non-dropping regmatches/strextract
Using a non-capturing group, "(?:...)" instead of "(...)", simplifies my example a bit > x <- c("Groucho <groucho at marx.com>", "<chico at marx.com>", "Harpo") > strcapture("([[:alpha:]]+)?(?: *<([[:alpha:]. ]+@[[:alpha:]. ]+)>)?", x, proto=data.frame(Name=character(), Address=character(),
2019 Aug 15
2
Feature request: non-dropping regmatches/strextract
I do think keeping the default behavior is desirable for backwards compatibility; my suggestion is not to change default behavior but to add an optional argument that allows a different behavior. Although this can be implemented in a user-defined function, retaining empty matches facilitates programmatic use, and seems to be something that should be available in base R. It is available, for
2013 Sep 30
1
str_count counts the substring
I am trying to count the number of times a word occurs in a string. and using str_count function from the package stringr. This function counts the substrings as well. Is there a way in which I can exclude the substring count and just take the exact match. Thanks in advance. -- Thanks and Regards Agrima Srivastava -------------------------------------------------------------------------------
2013 Feb 18
3
Cortar una cadena por un caracter solo cuando no forma parte de una subcadena entrecomillada
Hola, ¿qué tal? Tengo el siguiente problema. Me llegan (simplificando) cadenas del tipo 1,2,"algo"; 3,"cosa"; 4,2,3,7; y tengo que partirlas por el caracter ";" para meterlas en una lista. Lo hago con strsplit y no tengo problemas... ... hasta que recibo cadenas como 1,2,"algo;todo"; 3,"cosa"; 4,2,3,7; en las que existen puntos y coma
2012 Nov 07
3
extract indep vars from formula
Hello, I'm trying to extract the independent variables from a formula. The closest I've been able to come, aside from rolling my own, is the following: > a = y ~ b * x > attr(terms(formula(a)),"variables") The reason I'm doing this is that I'm building a grid of points that I use to construct a 3-d model prediction surface in rgl. If there are more than two
2011 Jun 22
2
strange date problem - May 3, 1992 is NA
> is.na(strptime("5/2/1992", format="%m/%d/%Y")) [1] FALSE > is.na(strptime("5/3/1992", format="%m/%d/%Y")) [1] TRUE Any idea what's going on with this? Running strptime against all dates from around 1946, only 5/3/1992 was converted as "NA". Even stranger, it still seems to have a value associated with it (even though is.na thinks
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
2006 Oct 07
2
gregexpr in R 2.3.0 != gregexpr in R 2.4.0
Hi all I have a question regarding differences in the way gregpexr works in R 2.3.0 and R 2.4.0. In R 2.3.0, this is what happens: > gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T) [[1]] [1] 1 3 5 7 9 attr(,"match.length") [1] 5 5 5 5 5 ... while in R 2.4.0, this is what happens: > gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T)
2013 Mar 20
3
summarize dataframe based on multiple cols, not their combinations
Hi folks, I'm trying to figure out how to get summarized data based on multiple columns. However, instead of giving summaries for every combination of categorical columns, I want it for each value of each categorical column regardless of the other columns. I could do this with three different commands, but i'm wondering if there's a more elegant way that I'm missing. Thanks!
2012 May 21
2
sweave tables as images?
Hello folks, I've been on a journey trying to figure out how to manage documents that are amenable to sharing and editing, but that contain dynamic content generated by R. I've come to the following solution: I use Sweave to generate labeled png & pdf figures, and I "Insert & Link" those figures as "Pictures" in a Word 2010 doc. Thus, when data or code
2006 Nov 07
1
Gregexpr - extract results with lapply
Gregexpr - extract results with lapply Hello, I need to extract sequences of three upper case letters in a string. In other words, in this string: str <-c("ABC", "this WOUld be gOOD") The result I'm looking for is ABC WOU OOD. With gregexpr, I can get the position and length of the sequences gregexpr('[A-Z]{3}',str,perl=TRUE) [[1]] [1] 1
2009 Feb 25
1
Using gregexpr with multiple search elements
Dear list, I am trying to use gregexpr to see if entries in a dataframe have either of two possible values for a string. here's an example text<-c("fat", "rat", "cat", "dog", "log", "fish") If I just wanted to find if any one of the elements in text match the pattern "at" I would do gregexpr("\\at", text)