-
Notifications
You must be signed in to change notification settings - Fork 1
/
05_nhsnumber.Rmd
70 lines (46 loc) · 968 Bytes
/
05_nhsnumber.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "nhsnumber"
subtitle: "Part 4 of the RStudio Tips and Tricks Series"
author: "Jeremy Allen"
date: "Nov 2, 2021, updated on `r Sys.Date()`"
output:
html_document:
highlight: zenburn
theme:
bg: "#303436"
fg: "#9da9af"
primary: "#ff8080"
base_font:
google: "Roboto"
code_font:
google: "JetBrains Mono"
editor_options:
chunk_output_type: console
self_contained: true
---
---
<br>
<br>
<https://nhsnumber.sellorm.com/>
![](images/nhs.png)
```{r packages, message=FALSE, warning=FALSE, include=FALSE}
library(nhsnumber)
```
## Check validity
```{r}
x <- c(9876543210, 1234567890, 1234567881)
nhsnumber::is_valid(x)
```
## Get checksum
```{r}
nhsnumber::get_checksum(123456788)
```
## Full output
```{r}
nhsnumber::get_checksum(123456788, full_output = TRUE)
```
## Bad numbers
```{r echo=TRUE, eval=FALSE}
nhsnumber::get_checksum(123456789)
```
![](images/checksum_error.png)