Re: [R] removing a specific number of digist from a character string

2007-09-17 Thread Jeffrey Robert Spies
test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif) sub('[[:digit:]][[:digit:]][[:digit:]][[:digit:]]\.tif', '', test) or test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif) sub('[[:digit:]]{4}\.tif', '', test)

Re: [R] removing a specific number of digist from a character string

2007-09-17 Thread Jeffrey Robert Spies
For the sake of absolute correctness: sub('[[:digit:]]{4}\.tif', '', test) should be sub('[[:digit:]]{4}\\.tif', '', test) -- Jeff. On Sep 17, 2007, at 11:59 AM, Jeffrey Robert Spies wrote: test - c(060907_17_3_5_1_1_2909.tif, 060907_17_3_5_2_1_2910.tif, 060907_17_3_5_3_1_2911.tif)

[R] removing a specific number of digist from a character string

2007-09-17 Thread Kim Milferstedt
Hello, I would like to remove the last 8 digists of character strings in a vector. Below I added a couple of elements from that vector. I have a problem defining a pattern to replace the digits using for example sub. Removing the .tif part works fine using sub('.tif',,x), but how do I get rid