Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nathansam committed Nov 4, 2021
1 parent 24eb785 commit 0804e4c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# datefixR 0.1.1

* First version of the package
* Added a `NEWS.md` file to track changes to the package.

8 changes: 8 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0804e4c

Please sign in to comment.