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)
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)
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
3 matches
Mail list logo