Re: [R] help with gsub and grep functions

2003-10-13 Thread John Fox
Dear Oliver, I believe that the following will give you what you want: At 04:30 PM 10/13/2003 +0200, Martin Olivier wrote: Hi all, Let Names a vector of chatacters. For example, Names [1] g 604 be-0 -p1 (602 matches) g 606 Phli-0 -p2 (517 matches) [3] g 608 alu-0 (659 matches) I try to use

RE: [R] help with gsub and grep functions

2003-10-13 Thread Simon Fear
Well, this works for the first one: sub( \\([A-Za-z0-9_ ]*\\), , Names) and from there the second one is fairly obvious I hope. QUESTION: having recently been using Source Edit I wanted to write [\\w]* instead of [A-Za-z0-9_ ]* but that doesn't seem to work in R. ?grep points to

RE: [R] help with gsub and grep functions

2003-10-13 Thread Prof Brian Ripley
On Mon, 13 Oct 2003, Simon Fear wrote: Well, this works for the first one: sub( \\([A-Za-z0-9_ ]*\\), , Names) and from there the second one is fairly obvious I hope. QUESTION: having recently been using Source Edit I wanted to write [\\w]* instead of [A-Za-z0-9_ ]* but that doesn't

Re: [R] help with gsub and grep functions

2003-10-13 Thread Arne Henningsen
On Monday 13 October 2003 16:30, Martin Olivier wrote: Hi all, Let Names a vector of chatacters. For example, Names [1] g 604 be-0 -p1 (602 matches) g 606 Phli-0 -p2 (517 matches) [3] g 608 alu-0 (659 matches) I try to use gsub or grep functions for two problems : 1. First, I would

RE: [R] help with gsub and grep functions

2003-10-13 Thread Gabor Grothendieck
If you split the strings using strsplit: s - strsplit(Names, *[()]) # remove space * if trailing space OK Then the two results are: sapply(s,[,-2) sapply(s,[,2) --- Date: Mon, 13 Oct 2003 16:30:37 +0200 From: Martin Olivier [EMAIL PROTECTED] Subject: [R] help with gsub and grep functions