From 0804e4c02d2810ff043b4247dce47cb116d6b6b3 Mon Sep 17 00:00:00 2001 From: Nathan Constantine-Cooke Date: Thu, 4 Nov 2021 12:07:32 +0000 Subject: [PATCH] Update documentation --- DESCRIPTION | 12 +++++++----- NEWS.md | 5 +++++ README.Rmd | 8 ++++++++ README.md | 14 +++++++++++++- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 NEWS.md diff --git a/DESCRIPTION b/DESCRIPTION index 35ae5e4..47a50e6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,12 @@ Package: datefixR -Title: Fix really messy dates -Version: 0.0.0.9000 -Authors@R: - person("Nathan", "Constantine-Cooke", , "nathan.constantine-cooke@ed.ac.uk", role = c("aut", "cre"), +Title: Fix Really Messy Dates +Version: 0.1.1 +Authors@R: person("Nathan", "Constantine-Cooke", email = "nathan.constantine-cooke@ed.ac.uk", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4437-8713")) -Description: What the package does (one paragraph). +Description: Fixes messy dates in data frames such as those entered via text + boxes. Standardizes / - and whitespace seperation, month abbreviations, and + year first or day first by converting to R's built-in Date class. Imputes + missing date or month using user-provided values. License: GPL (>= 3) Depends: R (>= 4.0.0) Imports: stringr diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..3920ba8 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,5 @@ +# datefixR 0.1.1 + +* First version of the package +* Added a `NEWS.md` file to track changes to the package. + diff --git a/README.Rmd b/README.Rmd index b5d5d03..e08bef2 100644 --- a/README.Rmd +++ b/README.Rmd @@ -59,6 +59,14 @@ fixed.df <- fix_dates(bad.dates, c("some.dates", "some.more.dates")) knitr::kable(fixed.df) ``` +By default, `datefixR` imputes missing days of the month as 01, and missing months as 07 (July). However, this behavior can be modified via the `day.impute` or `month.impute` arguments. + +```{R} + example.df <- data.frame(example = "1994") + +fix_dates(example.df, "example", month.impute = 1) +``` + ### Limitations The US date format of month first is not currently supported. This may change diff --git a/README.md b/README.md index c6cbc73..2be7eea 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,24 @@ knitr::kable(fixed.df) | id | some.dates | some.more.dates | |----:|:-----------|:----------------| -| 1 | 1992-05-02 | 2015-01-01 | +| 1 | 1992-05-02 | 2015-07-01 | | 2 | 2020-04-01 | 2000-05-02 | | 3 | 1996-05-01 | 1990-05-01 | | 4 | 2020-05-01 | 2012-08-01 | | 5 | 1996-04-02 | 2020-01-01 | +By default, `datefixR` imputes missing days of the month as 01, and +missing months as 07 (July). However, this behavior can be modified via +the `day.impute` or `month.impute` arguments. + +``` r + example.df <- data.frame(example = "1994") + +fix_dates(example.df, "example", month.impute = 1) +#> example +#> 1 1994-01-01 +``` + ### Limitations The US date format of month first is not currently supported. This may