Re: [R] Numbers in a string

2010-12-17 Thread Petr Savicky
On Fri, Dec 17, 2010 at 07:39:46AM -0500, Gabor Grothendieck wrote: > On Thu, Dec 16, 2010 at 11:42 AM, Petr Savicky wrote: [...] > > Can something similar be done in R either specifically for numbers or > > for a general regular expression? > > Dieter's first post in this thread already answered

Re: [R] Numbers in a string

2010-12-17 Thread Gabor Grothendieck
On Thu, Dec 16, 2010 at 11:42 AM, Petr Savicky wrote: > On Thu, Dec 16, 2010 at 06:17:45AM -0800, Dieter Menne wrote: >> Petr Savicky wrote: >> > >> > One of the suggestions in this thread was to use an external program. >> > A possible solution without negation in Perl is >> > >> >   @a = ("AB15E

Re: [R] Numbers in a string

2010-12-17 Thread Martin Maechler
> Petr Savicky > on Wed, 15 Dec 2010 14:21:37 +0100 writes: > On Wed, Dec 15, 2010 at 11:08:06AM -0200, Henrique > Dallazuanna wrote: >> Try this: >> >> gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") > Consider also > strsplit("AB15E9SDF654VKBN?dvb.65",

Re: [R] Numbers in a string

2010-12-16 Thread William Dunlap
re, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Petr Savicky > Sent: Thursday, December 16, 2010 8:42 AM > To: r-help@r-project.org > Subject: Re: [R] Numbers in a str

Re: [R] Numbers in a string

2010-12-16 Thread Petr Savicky
On Thu, Dec 16, 2010 at 06:17:45AM -0800, Dieter Menne wrote: > Petr Savicky wrote: > > > > One of the suggestions in this thread was to use an external program. > > A possible solution without negation in Perl is > > > > @a = ("AB15E9SDF654VKBN?dvb.65" =~ m/[0-9]/g); > > print @a, "\n"; > >

Re: [R] Numbers in a string

2010-12-16 Thread Dieter Menne
Petr Savicky wrote: > > One of the suggestions in this thread was to use an external program. > A possible solution without negation in Perl is > > @a = ("AB15E9SDF654VKBN?dvb.65" =~ m/[0-9]/g); > print @a, "\n"; > 15965465 > > Which is gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65")

Re: [R] Numbers in a string

2010-12-15 Thread Petr Savicky
On Wed, Dec 15, 2010 at 01:29:16PM -0500, David Winsemius wrote: > > On Dec 15, 2010, at 6:01 AM, Nick Sabbe wrote: > > >Hi Felipe, > > > >gsub("[^0123456789]", "", "AB15E9SDF654VKBN?dvb.65") > >results in "15965465". > >Would that be what you are looking for? > > > I tried figuring out how to

Re: [R] Numbers in a string

2010-12-15 Thread David Winsemius
? -- David. Nick Sabbe -- ping: nick.sa...@ugent.be link: http://biomath.ugent.be wink: A1.056, Coupure Links 653, 9000 Gent ring: 09/264.59.36 -- Do Not Disapprove -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Rainer Schu

Re: [R] Numbers in a string

2010-12-15 Thread Petr Savicky
On Wed, Dec 15, 2010 at 11:08:06AM -0200, Henrique Dallazuanna wrote: > Try this: > > gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") Consider also strsplit("AB15E9SDF654VKBN?dvb.65", "[^.0-9][^.0-9]*") [[1]] [1] """15" "9" "654" ".65" PS. > On Wed, Dec 15, 2010 at 6:55 AM, Luis Fe

Re: [R] Numbers in a string

2010-12-15 Thread Henrique Dallazuanna
Try this: gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") On Wed, Dec 15, 2010 at 6:55 AM, Luis Felipe Parra < felipe.pa...@quantil.com.co> wrote: > Hello, I have stings which have all sort of characters (numbers, letters, > punctuation marks, etc) I would like to stay only with the numbers in th

Re: [R] Numbers in a string

2010-12-15 Thread Nick Sabbe
ring: 09/264.59.36 -- Do Not Disapprove -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rainer Schuermann Sent: woensdag 15 december 2010 11:19 To: r-help@r-project.org Subject: Re: [R] Numbers in a string If your OS is Linux, you might want to

Re: [R] Numbers in a string

2010-12-15 Thread Rainer Schuermann
If your OS is Linux, you might want to look at sed or gawk. They are very good and efficient for such tasks. You need it once or as a part of program? Some samples would be helpful... Rgds, Rainer Original-Nachricht > Datum: Wed, 15 Dec 2010 16:55:26 +0800 > Von: Luis Felipe P

Re: [R] Numbers in a string

2010-12-15 Thread Dieter Menne
Luis Felipe Parra wrote: > > Hello, I have stings which have all sort of characters (numbers, letters, > punctuation marks, etc) I would like to stay only with the numbers in > them, > does somebody know how to do this? > > What to do if for AA3213Be45C02? A site search would have given a few