similar to: regular expressions in R?

Displaying 20 results from an estimated 20000 matches similar to: "regular expressions in R?"

2004 Feb 15
4
father and son heights
Faraway's book titled "Practical Regression and Anova using R", with full text available online at: http://cran.r-project.org/doc/contrib/Faraway-PRA.pdf refers to a data set, stat500, which compares midterm and final grades. It can be used to illustrate similar concepts. A google search for faraway.zip will locate the actual data. --- Date: Sun, 15 Feb 2004 10:37:08 -0800
2003 Nov 10
4
predict.lm with (logical) NA vector
I was surprised by the following (R 1.8.0): R> lm.fit = lm(y~x, data.frame(x=1:10, y=1:10)) R> predict(lm.fit, data.frame(x = rep(NA, 10))) 1 2 3 4 5 -1.060998e-314 -1.060998e-314 -1.060998e-314 -1.060998e-314 -1.060998e-314 6 7 8 9 10 0.000000e+00
2007 Jun 28
3
: regular expressions: escaping a dot
What's really the problem with: > regexpr( '\.odt$', "xxxxYodt", perl=TRUE ) Warning: '\.' is an unrecognized escape in a character string Warning: unrecognized escape removed from "\.odt$" [1] 5 attr(,"match.length") [1] 4 I know that I could use: > regexpr( '[.]odt$', "xxxxYodt", perl=TRUE ) But it seems to me that
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
2008 Dec 02
1
Question to regular expressions
Hi there, I know, this question is not directly an R-help question but probably someone can give me a hint how to deal with the following problem. I have a vector with file/folder names and want to filter for all entries which have 6 numbers in a row and nothing else. folders <- c("folder1", "f2", "F234562", "12345678", "234567",
2008 Jul 08
4
Manipulate Data (with regular expressions)
Dear Everyone, I try to automatically manipulate the data of a variable (class = factor) like x 220 220a 221 221b B221 Into two variables (class = numeric) like x y 220 0 220 1 221 0 221 1 221 1 y has to carry the information about the class (number or string) of the former x-Variable. I could do it by hand like x[x == "220a"] <- 220
2009 Jun 08
3
using regular expressions to retrieve a digit-digit-dot structure from a string
Hi, i need to recognize itemization structures in strings which follow the format: "digit-digit-dot" like e.g. 1. 2. 19. 211. Given the string " This happened in the 21. century." (the dot behind 21 is used in German instead of 21st) I want know where the dots are but I do not want the 21.-dot to be returned as well. I am not good at regular expressions. How
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 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
2017 Apr 04
2
Bug report: POSIX regular expression doesn't match for somewhat higher values of upper bound
Dear Sirs, while > regexpr('(.{1,2})\\1', 'foo') [1] 2 attr(,"match.length") [1] 2 attr(,"useBytes") [1] TRUE yields the correct match, an incremented upper bound in > regexpr('(.{1,3})\\1', 'foo') [1] -1 attr(,"match.length") [1] -1 attr(,"useBytes") [1] TRUE incorrectly yields no match. R versions tested: 2.11.1
2006 Jan 27
4
regular expressions, sub
Hi, I am trying to use sub, regexpr on expressions like log(D) ~ log(N)+I(log(N)^2)+log(t) being a model specification. The aim is to produce: "ln D ~ ln N + ln^2 N + ln t" The variable names N, t may change, the number of terms too. I succeded only partially, help on regular expressions is hard to understand for me, examples on my case are rare. The help page on R-help
2009 Mar 04
2
Number Regular Expressions
Hi, I'm trying to write a regular expression that captures numbers in the form 9,007,653,372,262.48 but does not capture dates in the form 09/30/2005 I have tried numerous expressions, but they all seem to return the dates as well. Thanks. [[alternative HTML version deleted]]
2009 Nov 13
3
Escaping regular expressions
Hi all, Is there a method for escaping strings to be used regular expressions? i.e. if I have a user supplied string that I'd like to use as a fixed component is there a method that will turn (e.g.) ".$^" into "\\.\\$\\^" ? Thanks, Hadley -- http://had.co.nz/
2008 Mar 06
1
invalid regular expression '[a-Z]'
Hi, just curious, but does anyone know the source/reason of observing the following error on OSX but not on WinXP and Linux? I've tried with a few different versions of R (v2.5.1, v2.6.1, v2.6.2, v2.7.0devel). The locale does not seem to affect the error, i.e. I've tested a few different and it is still only OSX that gives the error but not the other two. > regexpr("[a-Z]",
2017 Jun 08
2
regular expression help
Dear All, My query is: Do we always need to use perl = TRUE option when doing ignore.case=TRUE? A small example : my_text = "RECOVERY OFFICER-II\nDEBTS RECOVERY TRIBUNAL-III\n RC No. 162/2015\nSBI VS RAMESH GUPTA.\n Dated: 01.03.2016 Item no.01\n Present: Ms. Sonakshi, the proxy counsel for Ms. Usha Singh, the counsel for ARCIL.\n None for the CDs.\n
2017 Jun 08
0
regular expression help
Zitat von Ashim Kapoor <ashimkapoor at gmail.com>: > Dear All, > > My query is: > > Do we always need to use perl = TRUE option when doing ignore.case=TRUE? > > A small example : > > my_text = > "RECOVERY OFFICER-II\nDEBTS RECOVERY TRIBUNAL-III\n RC No. 162/2015\nSBI > VS RAMESH GUPTA.\n Dated: 01.03.2016 Item no.01\n > Present:
2000 Oct 23
1
Regular Expression and Pmatch
Hi, I wonder if there's a good intro to the pattern matching using R? I'm a perl programer and find it too confusing and complex to use regular expressions under R. For instance, why does pmatch("d","ad") returns NULL? How would I call the functions in order to match any portion of the string? Under what circumstances shall backslush be used? I try to extract all
2000 Oct 11
2
invalid regular expression after many grep's (PR#691)
Full_Name: J Utans Version: 1.1.1 OS: NT4 (SP6) Submission from: (NULL) (155.140.123.250) After grep is called many times (> 250k), with constant strings as patterns, it complains with "invalid regular expression" on calls that worked before (with same pattern and x). At the same time copying to the clipboard does no longer work with "out of memory" error (i.e. when trying
2007 Jul 30
8
regular expressions : extracting numbers
Hello all, I have a vector of character strings, in which I have letters, numbers, and symbols. What I wish to do is obtain a vector of the same length with just the numbers. A quick example - extract of the original vector : "lema, rb 2%" "rb 2%" "rb 3%" "rb 4%" "rb 3%" "rb 2%,mineuse" "rb" "rb" "rb 12"
2011 Jun 14
1
Calling R from Java
Up, Any helps in this would be really appreciated. I stuck with this. Regards --- On Mon, 6/13/11, saleh [via R] <ml-node+3593743-1399725529-244676@n4.nabble.com> wrote: From: saleh [via R] <ml-node+3593743-1399725529-244676@n4.nabble.com> Subject: Calling R from Java To: "saleh" <s.alhammed@yahoo.com> Date: Monday, June 13, 2011, 12:35 PM Dear Sir/Madam, Sorry