[R] How to get values out of a string using regular expressions?

2010-05-28 Thread Joris Meys
Dear all, I have a vector of filenames which begins like this : X - c(OrthoP1_DNA_str.aln, OrthoP10_DNA_str.aln, OrthoP100_DNA_str.aln, OrthoP101_DNA_str.aln, OrthoP102_DNA_str.aln, OrthoP103_DNA_str.aln, OrthoP104_DNA_str.aln, OrthoP105_DNA_str.aln, OrthoP106_DNA_str.aln, OrthoP107_DNA_str.aln)

Re: [R] How to get values out of a string using regular expressions?

2010-05-28 Thread Gabor Grothendieck
Try this: as.numeric(gsub(\\D, , X)) On Fri, May 28, 2010 at 8:21 AM, Joris Meys jorism...@gmail.com wrote: Dear all, I have a vector of filenames which begins like this : X - c(OrthoP1_DNA_str.aln, OrthoP10_DNA_str.aln, OrthoP100_DNA_str.aln, OrthoP101_DNA_str.aln, OrthoP102_DNA_str.aln,

Re: [R] How to get values out of a string using regular expressions?

2010-05-28 Thread Joris Meys
Bingo! Thx Gabor. Thank you too Tal, I looked briefly at the package and it looks like a nice interface. I keep it in mind for later. Cheers Joris On Fri, May 28, 2010 at 2:25 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: as.numeric(gsub(\\D, , X)) On Fri, May 28, 2010