[R] Checking dates for entry errors

Terry Therneau therneau at mayo.edu
Wed Jan 18 15:22:28 CET 2012


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.

It depends on the study.
  1. Simple: use as.Date on the data, and find resultant missing values.
You might have to add a format to the as.Date call: if I use
as.Date("2001-02-29", format="%Y-%m-%d") I get an NA as desired (no Feb
29th that year); without it a message that the function can't guess the
right format.

  2. Better: with data set checks.  Say that I have dates of birth,
study enrollment, study events (lab tests), and termination.
    Age at entry within the study eligibity criteria
    All study events happen between erollment and termination
    Termination after enrollment
    etc



More information about the R-help mailing list