Re: [R] modifying vector elements

2010-07-13 Thread Gabor Grothendieck
On Tue, Jul 13, 2010 at 3:20 AM, Lorenzo Cattarino wrote: > Hello R-users, > > > > I have a very large vector (a) containing elements consisting of numbers > and letters, this is the  i.e. > > a > > [1] "1.11.2a"     "1.11.2d"     "1.11.2e"     "1.11.2f"     "1.11.2x1" > "1.11.2x1b" > [...] > > Ho

Re: [R] modifying vector elements

2010-07-13 Thread Bill.Venables
Here is one way a_clip <- sub("^([0-9]+\\.[0-9]+\\.[0-9]+).*$", "\\1", a) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Lorenzo Cattarino Sent: Tuesday, 13 July 2010 5:20 PM To: r-help@r-project.org

[R] modifying vector elements

2010-07-13 Thread Lorenzo Cattarino
Hello R-users, I have a very large vector (a) containing elements consisting of numbers and letters, this is the i.e. a [1] "1.11.2a" "1.11.2d" "1.11.2e" "1.11.2f" "1.11.2x1" "1.11.2x1b" [7] "1.11.2x2""1.11.2x2a" "1.11.2x2b" "1.11.2x3""1.11.2x4" "1.11.2x4a"