Re: [R] Maximum number of patterns and speed in grep

2012-07-23 Thread mdvaan
Hi, I have a minor follow-up question: In the example below, "ann" and "nn" in the third element of text are matched. I would like to ignore all matches in which the character following the match is one of [:alpha:]. How do I do this without removing the "ignore.case = TRUE" argument of the strap

Re: [R] Maximum number of patterns and speed in grep

2012-07-16 Thread mdvaan
Thanks! That worked like a charm. Math Gabor Grothendieck wrote > > On Fri, Jul 13, 2012 at 1:41 PM, mdvaan wrote: >> Here's some data (which should give you the error messages): >> >> # read in data >> data <- read.csv("https://dl.dropbox.com/u/13631687/data.csv";, hea

Re: [R] Maximum number of patterns and speed in grep

2012-07-15 Thread Gabor Grothendieck
On Fri, Jul 13, 2012 at 1:41 PM, mdvaan wrote: > Here's some data (which should give you the error messages): > > # read in data > data <- read.csv("https://dl.dropbox.com/u/13631687/data.csv";, header = > T, sep = ",") > > # first paste all data > data1 <- paste(data[,1], collapse

Re: [R] Maximum number of patterns and speed in grep

2012-07-15 Thread mdvaan
Here's some data (which should give you the error messages): # read in data data <- read.csv("https://dl.dropbox.com/u/13631687/data.csv";, header = T, sep = ",") # first paste all data data1 <- paste(data[,1], collapse = "|") # second paste subsets of the data da

Re: [R] Maximum number of patterns and speed in grep

2012-07-13 Thread Gabor Grothendieck
On Fri, Jul 13, 2012 at 9:40 AM, mdvaan wrote: > Thanks, I see that it is working in the sample data. My data, however, gives > me an error message: > > data <- strapplyc(text, batch[[l]]) > Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = > "tclObj") : > [tcl] couldn't co

Re: [R] Maximum number of patterns and speed in grep

2012-07-13 Thread mdvaan
Thanks, I see that it is working in the sample data. My data, however, gives me an error message: data <- strapplyc(text, batch[[l]]) Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") : [tcl] couldn't compile regular expression pattern: parentheses () not balan

Re: [R] Maximum number of patterns and speed in grep

2012-07-06 Thread mdvaan
Thanks for the quick response. I should phrase my question differently because everything is working fine, I am just trying to find a more efficient approach: 1. What's the maximum size of the patterns argument in grep? Can't find it online. 2. I am trying to match 7,700 character strings to abou

Re: [R] Maximum number of patterns and speed in grep

2012-07-06 Thread Gabor Grothendieck
On Fri, Jul 6, 2012 at 10:45 AM, mdvaan wrote: > Hi, > > I am using R's grep function to find patterns in vectors of strings. The > number of patterns I would like to match is 7,700 (of different sizes). I > noticed that I get an error message when I do the following: > > data <- array() > for (j

Re: [R] Maximum number of patterns and speed in grep

2012-07-06 Thread Sarah Goslee
Hi, Given that you can't provide a full example, please at least provide str() on your data, more complete information on the problem, and ideally a small toy example that demonstrates precisely what you are doing. For instance, you tell us that you "get an error message" but you never tell us wh

[R] Maximum number of patterns and speed in grep

2012-07-06 Thread mdvaan
Hi, I am using R's grep function to find patterns in vectors of strings. The number of patterns I would like to match is 7,700 (of different sizes). I noticed that I get an error message when I do the following: data <- array() for (j in 1:length(x)) { array[j] <- length(grep(paste(patterns[1:77