regular expression

Parsing date strings

No votes yet

This question hit the R-help list, and I thought I'd list all the given solutions, including mine using regular expressions:

This person had a variable 'x':

x
[1] "2005-09-01"

And he wanted to create three variables, y, m, and d, such that:

y = 2005
m = 09
d = 01

Read more

Remove digits from character vectors

No votes yet

This problem was posed on the R-help mailing list:

"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 of the four preceding digits?"

Read more

Starting with a capital letter

No votes yet

From the R-Help mailing list, it was asked whether or not there was a function that could determine whether words in a character vector start with a capital letter or not.

Read more

Syndicate content