[R] Checking dates for entry errors

David Winsemius dwinsemius at comcast.net
Tue Jan 17 15:43:16 CET 2012


On Jan 17, 2012, at 8:02 AM, Thomas Mang wrote:

> On 1/11/2012 11:07 PM, Paul Miller wrote:
>> Hello Everyone,
>>
>> I have a question about how best to check dates for entry errors.
>
> Try using regular expression matching and the functions grep,  
> strsplit, regexpr etc.
> If you are not familiar with regex: bit a bumpy road of getting into  
> it but in the long term definitely worth the effort !

Agree on all points, but also simply converting to the Date class and  
using the ?Comparison operators is informative. And there may be NA's  
that will signal impossible month-day combinations which would be  
tedious to identify with regex.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list