Skip to content

Commit

Permalink
Merge pull request #45 from CDU-data-science-team/44-vignette
Browse files Browse the repository at this point in the history
Vignette for year_date()
  • Loading branch information
Zoë Turner authored Oct 29, 2021
2 parents 8a9e49c + e1139f2 commit d61a5a1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.httr-oauth
.DS_Store
docs
inst/doc
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Suggests:
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Imports:
Expand All @@ -38,3 +39,4 @@ Remotes:
mitchelloharawild/icons,
gadenbuie/xaringanExtra,
nhs-r-community/nhsrtheme
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
36 changes: 36 additions & 0 deletions vignettes/date_helper.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: "date_helper"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{date_helper}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

```{r setup}
library(nottshcMethods)
library(NHSRdatasets)
```

# ONS Mortality

Using the {NHSRdatasets} package and particularly the ons_mortality dataset, this finds the earliest and latest years in the dataset, useful for showing or referring to the date range in a dataset.

The function works with date, integer and character formats if the date is in the format yyyy-mm-dd, for example:

The ons_mortality dataset is from `r year_date(ons_mortality, date, type = "earliest")` to `year_date(ons_mortality, date, type = "latest")`

```{r}
year_date(ons_mortality, date, type = "earliest")
year_date(ons_mortality, date, type = "latest")
```

0 comments on commit d61a5a1

Please sign in to comment.