-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from CDU-data-science-team/44-vignette
Vignette for year_date()
- Loading branch information
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.httr-oauth | ||
.DS_Store | ||
docs | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.html | ||
*.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
``` | ||
|