Re: [Rd] extending strsplit(): supply pattern to keep, not to split by

2006-04-06 Thread Gabor Grothendieck
To follow up, strapply has been added to the gsubfn package (gsubfn 0.1-1) which should make it easier to address this problem. Its basically just a sapply call around gsubfn which returns the transformed matches rather than performing substitution. Its analogous to apply: apply(object,

Re: [Rd] extending strsplit(): supply pattern to keep, not to split by

2006-04-04 Thread Gabor Grothendieck
On 4/4/06, Bill Dunlap <[EMAIL PROTECTED]> wrote: > On Tue, 4 Apr 2006, Gabor Grothendieck wrote: > > > gsubfn in package gsubfn can do this. See the examples > > in ?gsubfn > > Thanks. gsubfn looks useful, but may be overkill > for this, and it isn't vectorized. To do what gsubfn is vectorized

Re: [Rd] extending strsplit(): supply pattern to keep, not to split by

2006-04-04 Thread Bill Dunlap
On Tue, 4 Apr 2006, Gabor Grothendieck wrote: > gsubfn in package gsubfn can do this. See the examples > in ?gsubfn Thanks. gsubfn looks useful, but may be overkill for this, and it isn't vectorized. To do what strsplit(keep=T) would do I think you need to do something like: > findMatches<

Re: [Rd] extending strsplit(): supply pattern to keep, not to split by

2006-04-04 Thread Gabor Grothendieck
gsubfn in package gsubfn can do this. See the examples in ?gsubfn On 4/4/06, Bill Dunlap <[EMAIL PROTECTED]> wrote: > strsplit() is a convenient way to get a > list of items from a string when you > have a regular expression for what is not > an item. E.g., > > > strsplit("1.2, 34, 1.7e-2", s

[Rd] extending strsplit(): supply pattern to keep, not to split by

2006-04-04 Thread Bill Dunlap
strsplit() is a convenient way to get a list of items from a string when you have a regular expression for what is not an item. E.g., > strsplit("1.2, 34, 1.7e-2", split="[ ,] *") [[1]]: [1] "1.2""34" "1.7e-2" However, sometimes is it more convenient to give a pattern for the it