similar to: regular expression

Displaying 20 results from an estimated 5000 matches similar to: "regular expression"

2010 Mar 16
3
remove substring from each string vector component
Hi all, I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") I need to remove all the occurrences of "\t", in order to obtain: x = "1" "2" "3" I'm trying to use the function substring2, and it works for each component, for example: substring2(x[1], "\t") ="" gives x = "1"
2009 Sep 16
3
How to extract a specific substring from a string (regular expressions) ? See details inside
Hi all, I have thousands of strings like these ones: "1159_1; YP_177963; PPE FAMILY PROTEIN" "1100_13; SECRETED L-ALANINE DEHYDROGENASE ALD CAA15575" "1141_24; gi;2894249;emb;CAA17111.1; PROBABLE ISOCITRATE DEHYDROGENASE" and various others.. I'm interested to extract the code for the protein (in this example: YP_177963, CAA15575, CAA17111). I
2010 Apr 23
1
ggplot2: how to specify x-axis limits to geom_abline() ?
Hi all, I'd want to plot a segment from a line specified by slope and intercept. I want to plot this line between two limits, x1 and x2, without imposing these limits to the hole plot as it is the case with scale_x_continuous(limits=c(x1,x2)) or with xlim and ylim. Any idea? Arnaud Chozo [[alternative HTML version deleted]]
2006 May 30
2
regular expression on predicates
is there a way to place regular expressions on predicates like ~ in awk such that /execname ~ prog/ matches all executables with the ''prog'' substring? thanks. This message posted from opensolaris.org
2006 Jun 11
2
regular expression question
I am very much a novice with regular expressions and I have spent a decent amount of time trying to do the following and I can't get it. i have variables that are of type character but they have number characters at the end. for example : "AAL123" "XELB245" "A247" I want a command that gives me just gives me the letter characters for each one. the letter
2009 Jul 08
5
R regular expression to extract words with the query string.
Hi, Is there a way in R to get the string which matches the expression, where the expression is a substring of the parent string. Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" What I need is the string "pid:ENSP000012345" from $i using the query "ENSP". Appreciate your comments. Praveen Surendran School of Medicine and
2010 Mar 29
3
how to update R files included as"source" ?
Hi all, I have a main file main.R in which I include some other R files. For example, in main.R I have: source("functions.R"). When I modify the file "functions.R", I'd like R to take into account the changes and to reload the file functions.R when I run main.R Is it possible? Thanks, Arnaud [[alternative HTML version deleted]]
2010 May 02
2
Retrieve regular expression groups
I'm trying to figure out how to get the text captured by capturing groups out of a regex match. For instance, let's say I have the pattern "foo ([^ ]+)" and I match it against the string "This is a foo sentence I am reading." The group in the pattern will match the word "sentence" in the target string. How can I get access to this matched group? All I
2011 Jun 05
1
Negating two identical characters with regular expressions
Hello all, Let's say I have a character string "Race-ethnicity-----coding information" I want to extract all text before the multiple dashes, including the word "ethnicity." I wrote a handy function to extract the first matched text: grepcut <- function(pattern,x){ start.and.length <- regexpr(pattern,x) substring(x,start.and.length,start.and.length
2010 Apr 16
3
problem with FUN in Hmisc::summarize
Hi all, I'd like to use the Hmisc::summarize function, but it uses a function (FUN) of a single vector argument to create the statistical summaries. Consider an easy case: I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same dataframe. For exemple, consider the following dataframe D: V1 V2 V3 A 1 -1 A 1
2010 Apr 27
1
How to plot a table of numbers as an image using ggplot2?
Hi all, I'd want to plot a table of numbers such that the values are represented by gray level. Is there an easy way to do that using ggplot2? Thanks, Arnaud [[alternative HTML version deleted]]
2012 Nov 08
3
strsplit with invalid regular expression
Hi all, > diff_operator <- "\\(" > strsplit(cond, diff_operator) [[1]] [1] "andsin" "log_angle_1_4)" > diff_operator <- "\\sin(" > strsplit(cond, diff_operator) Error in strsplit(cond, diff_operator) : invalid regular expression '\sin(', reason 'Missing ')'' When I am going to split with "("
2008 May 01
2
regular expression question
I have strings of the form TICKER.GGG.XXXXXX.dat but GGG is not always three characters so I can't use substr to pull it out of the string. Could someone tell me how to use sub to pull out the GGG but more generally the string between the dot after the R in TICKER and the next dot. I still don't have a very good understanding of regular expressions but I'm trying to get that
2010 Aug 09
3
Regular Expression
Hi all, >From a list of strings, I desire to filter out the followings: 1. Digits at the beginning of the strings 2. Character "SPE" following the digits (if it exists) 3. Any characters followed by hyphen The following produces the desired result, but would like to know whether this can be done more efficiently. Any suggestions would be much appreciated. dat <- c("2148
2010 Nov 05
1
Regular Expressions
Hi, I'm trying to figure out how to use capturing parenthesis in regular expressions in R. (Doing this in Perl, Java, etc. is fairly trivial, but I can't seem to find the functionality in R.) For example, given the string: "10 Nov 13.00 (PFE1020K13)" I want to capture the first to digits and then the month abreviation. In perl, this would be /^(\d\d)\s(\w\w\w)\s/ Then
2020 Oct 05
2
isc-dhcp dynamic update problem
Hi, I have a buster system configured as a DC running 4.11.13 from Louis's repo. I am trying to get https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9 working. Mostly it seems to work but there seems to be a problem with what dhcpd writes into the leases file in the "on release" stanza. When dhcpd writes the On Release stanza I get something like the
2019 Feb 22
1
Bug: time complexity of substring is quadratic as string size and number of substrings increases
On 2/20/19 7:55 PM, Toby Hocking wrote: > Update: I have observed that stringi::stri_sub is linear time complexity, > and it computes the same thing as base::substring. figure > https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.png > source: > https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.R > > To me this is a
2010 Jun 04
2
Argument recycling in substring()
Hi, According to its man page substring() "expands (its) arguments cyclically to the length of the longest _provided_ none are of zero length". So, as expected, I get an error here: > substring("abcd", first=2L, last=integer(0)) Error in substring("abcd", first = 2L, last = integer(0)) : invalid substring argument(s) But I don't get one here:
2010 Mar 15
1
problem in reading trajectory file
Hi, I'm trying to read some trajectory files (text files) which have the form: # trial n # t X Y 0 1 2 0.2 1 3 0.4 1.2 4 ... # trial n+1 # t X Y 0 1 2 0.2 1.3 3.3 0.4 1.5 5 ... ... where the symbol # means that the line is not a numeric value, but I still need to read the number of the trial (n=1, 2, etc.). I
2019 Feb 20
2
Bug: time complexity of substring is quadratic as string size and number of substrings increases
Hi all, (and especially hi to Tomas Kalibera who accepted my patch sent yesterday) I believe that I have found another bug, this time in the substring function. The use case that I am concerned with is when there is a single (character scalar) text/subject, and many substrings to extract. For example substring("AAAA", 1:4, 1:4) or more generally, N=1000