You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/Public-Health-Scotland/phsmethods/releases/latest)
-`create_age_groups()` categorises ages into groups
26
-
-`chi_check()` assesses the validity of a CHI number
27
-
-`chi_pad()` adds a leading zero to nine-digit CHI numbers
28
-
-`sex_from_chi()` extracts the sex of a person from a CHI number
29
-
-`file_size()` returns the names and sizes of files in a directory
30
-
-`extract_fin_year()` assigns a date to a financial year in the format `YYYY/YY`
31
-
-`match_area()` converts geography codes into area names
32
-
-`format_postcode()` formats improperly recorded postcodes
33
-
-`qtr()`, `qtr_end()`, `qtr_next()` and `qtr_prev()` assign a date to a quarter
34
-
-`age_calculate()` calculates age between two dates
35
-
-`dob_from_chi()` extracts Date of Birth (DoB) from the CHI number
36
-
-`age_from_chi()` extracts age from the CHI number
27
+
<!-- badges: end -->
37
28
38
-
`phsmethods` can be used on both the PHS server and desktop versions of RStudio.
29
+
`phsmethods` contains functions for commonly undertaken analytical tasks
30
+
in [Public Health Scotland
31
+
(PHS)](https://www.publichealthscotland.scot/):
32
+
33
+
-`create_age_groups()` categorises ages into groups.
34
+
-`chi_check()` assesses the validity of a CHI number.
35
+
-`chi_pad()` adds a leading zero to nine-digit CHI numbers.
36
+
-`sex_from_chi()` extracts the sex of a person from a CHI number.
37
+
-`extract_fin_year()` assigns a date to a financial year in the
38
+
format `YYYY/YY`.
39
+
-`match_area()` converts geography codes into area names.
40
+
-`format_postcode()` formats improperly recorded postcodes.
41
+
-`qtr()`, `qtr_end()`, `qtr_next()` and `qtr_prev()` assign a date to
42
+
a quarter.
43
+
-`age_calculate()` calculates age between two dates.
44
+
-`dob_from_chi()` extracts Date of Birth (DoB) from the CHI number.
45
+
-`age_from_chi()` extracts age from the CHI number.
46
+
47
+
`phsmethods` can be used on both the PHS server and desktop versions of
48
+
RStudio.
39
49
40
50
## Installation
41
51
42
-
If you are using the PHS Posit Workbench the default repository is the PHS Posit Package Manager, the benefit of this is that `phsmethods` is listed there so you can install it with:
52
+
If you are using the PHS Posit Workbench the default repository is the
53
+
PHS Posit Package Manager, the benefit of this is that `phsmethods` is
54
+
listed there so you can install it with:
43
55
44
56
```r
45
57
install.packages("phsmethods")
46
58
```
47
59
48
-
To install `phsmethods` directly from GitHub, the package `remotes` is required, and can be
49
-
installed with `install.packages("remotes")`.
60
+
To install `phsmethods` directly from GitHub, the package `remotes` is
61
+
required, and can be installed with `install.packages("remotes")`.
50
62
51
63
You can then install `phsmethods` from GitHub with:
and running the following code (replacing the section marked `<>`,
62
74
including the arrows themselves):
@@ -75,42 +87,108 @@ Load `phsmethods` using `library()`:
75
87
library(phsmethods)
76
88
```
77
89
78
-
To see the documentation for any `phsmethods`' functions, type `?function_name` into the RStudio console after loading the package:
90
+
To see the documentation for any `phsmethods`' functions, type
91
+
`?function_name` into the RStudio console after loading the package:
79
92
80
93
```{r help, eval = FALSE}
81
94
?extract_fin_year
82
95
?format_postcode
83
96
```
84
97
85
-
You can access the full list of functions and their help pages on [Reference page of pkgdown website](https://public-health-scotland.github.io/phsmethods/reference/index.html). You will be able to see some examples of each function.
98
+
You can access the full list of functions and their help pages on
You will be able to see some examples of each function.
86
102
87
-
There is also a very useful [PHS Methods online training course](https://scotland.shinyapps.io/phs-learnr-phsmethods) which gives you an interactive way to learn about this package.
103
+
There is also a very useful [PHS Methods on-line training
104
+
course](https://scotland.shinyapps.io/phs-learnr-phsmethods) which gives
105
+
you an interactive way to learn about this package.
88
106
89
107
## Contributing to phsmethods
90
108
91
-
At present, the maintainer of this package is [Tina Fu](https://github.com/Tina815).
92
-
93
-
This package is intended to be in continuous development and contributions may be made by anyone within PHS. If you would like to contribute, please first create an [issue](https://github.com/Public-Health-Scotland/phsmethods/issues) on GitHub and assign **both** of the package maintainers to it. This is to ensure that no duplication of effort occurs in the case of multiple people having the same idea. The package maintainers will discuss the issue and get back to you as soon as possible.
94
-
95
-
While the most obvious and eye-catching (as well as intimidating) way of contributing is by writing a function, this isn't the only way to make a useful contribution. Fixing typos in documentation, for example, isn't the most glamorous way to contribute, but is of great help to the package maintainers. Please see this [blog post by Jim Hester](https://www.tidyverse.org/blog/2017/08/contributing/) for more information on getting started with contributing to open-source software.
96
-
97
-
When contributing, please create a [branch](https://github.com/Public-Health-Scotland/phsmethods/branches) in this repository and carry out all work on it. Please ensure you have linked RStudio to your GitHub account using `usethis::edit_git_config()` prior to making your contribution. When you are ready for a review, please create a [pull request](https://github.com/Public-Health-Scotland/phsmethods/pulls) and assign **both** of the package maintainers as reviewers. One or both of them will conduct a review, provide feedback and, if necessary, request changes before merging your branch.
98
-
99
-
Please be mindful of information governance when contributing to this package. No data files (aside from publicly available and downloadable datasets or unless explicitly approved), server connection details, passwords or person identifiable or otherwise confidential information should be included anywhere within this package or any other repository (whether public or private) used within PHS. This includes within code and code commentary. For more information on security when using git and GitHub, and on using git and GitHub for version control more generally, please see the [Transforming Publishing Programme](https://www.isdscotland.org/Products-and-Services/Transforming-Publishing-Programme/)'s [Git guide](https://Public-Health-Scotland.github.io/git-guide/) and [GitHub guidance](https://github.com/Public-Health-Scotland/GitHub-guidance).
100
-
101
-
Please feel free to add yourself to the 'Authors' section of the `Description` file when contributing. As a rule of thumb, please assign your role as author (`"aut"`) when writing an exported function, and as contributor (`"ctb"`) for anything else.
102
-
103
-
`phsmethods` will, as much as possible, adhere to the [tidyverse style guide](https://style.tidyverse.org/) and the [rOpenSci package development guide](https://devguide.ropensci.org/). The most pertinent points to take from these are:
104
-
105
-
- All function names should be in lower case, with words separated by an underscore
106
-
- Put a space after a comma, never before
107
-
- Put a space before and after infix operators such as `<-`, `==` and `+`
108
-
- Limit code to 80 characters per line
109
-
- Function documentation should be generated using [`roxygen2`](https://github.com/r-lib/roxygen2)
110
-
- All functions should be tested using [`testthat`](https://github.com/r-lib/testthat)
111
-
- The package should always pass `devtools::check()`
112
-
113
-
It's not necessary to have experience with GitHub or of building an R package to contribute to `phsmethods`. If you wish to contribute code then, as long as you can write an R function, the package maintainers can assist with error handling, writing documentation, testing and other aspects of package development. It is advised, however, to consult [Hadley Wickham's R Packages book](https://r-pkgs.org/) prior to making a contribution. It may also be useful to consult the [documentation](https://github.com/Public-Health-Scotland/phsmethods/tree/master/R) and [tests](https://github.com/Public-Health-Scotland/phsmethods/tree/master/tests/testthat) of existing functions within this package as a point of reference.
114
-
115
-
Please note that this README may fail to 'Knit' at times as a result of network security settings. This will likely be due to the badges for the package's release version, continuous integration status and test coverage at the top of the document. You should only make edits to the `.Rmd` version, you can then knit yourself, or a GitHub action should run and knit it for you when you open a pull request.
116
-
109
+
At present, the maintainer of this package is [Tina
110
+
Fu](https://github.com/Tina815).
111
+
112
+
This package is intended to be in continuous development and
113
+
contributions may be made by anyone within PHS. If you would like to
114
+
contribute, please first create an
115
+
[issue](https://github.com/Public-Health-Scotland/phsmethods/issues) on
116
+
GitHub and assign **both** of the package maintainers to it. This is to
117
+
ensure that no duplication of effort occurs in the case of multiple
118
+
people having the same idea. The package maintainers will discuss the
119
+
issue and get back to you as soon as possible.
120
+
121
+
While the most obvious and eye-catching (as well as intimidating) way of
122
+
contributing is by writing a function, this isn't the only way to make a
123
+
useful contribution. Fixing typos in documentation, for example, isn't
124
+
the most glamorous way to contribute, but is of great help to the
125
+
package maintainers. Please see this [blog post by Jim
126
+
Hester](https://www.tidyverse.org/blog/2017/08/contributing/) for more
127
+
information on getting started with contributing to open-source
0 commit comments