phsmethods
An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.9%) to scientific vocabulary
Keywords
r-package
Last synced: 10 months ago
·
JSON representation
Repository
An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
Basic Info
- Host: GitHub
- Owner: Public-Health-Scotland
- Language: R
- Default Branch: master
- Homepage: https://public-health-scotland.github.io/phsmethods/
- Size: 6.7 MB
Statistics
- Stars: 56
- Watchers: 5
- Forks: 13
- Open Issues: 19
- Releases: 9
Topics
r-package
Created almost 7 years ago
· Last pushed 11 months ago
Metadata Files
Readme
Changelog
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# phsmethods
[](https://CRAN.R-project.org/package=phsmethods)
[](https://github.com/Public-Health-Scotland/phsmethods/releases/latest)
[](https://github.com/Public-Health-Scotland/phsmethods/actions)
[](https://app.codecov.io/gh/Public-Health-Scotland/phsmethods)
`phsmethods` contains functions for commonly undertaken analytical tasks in [Public Health Scotland (PHS)](https://www.publichealthscotland.scot/):
- `create_age_groups()` categorises ages into groups
- `chi_check()` assesses the validity of a CHI number
- `chi_pad()` adds a leading zero to nine-digit CHI numbers
- `sex_from_chi()` extracts the sex of a person from a CHI number
- `file_size()` returns the names and sizes of files in a directory
- `extract_fin_year()` assigns a date to a financial year in the format `YYYY/YY`
- `match_area()` converts geography codes into area names
- `format_postcode()` formats improperly recorded postcodes
- `qtr()`, `qtr_end()`, `qtr_next()` and `qtr_prev()` assign a date to a quarter
- `age_calculate()` calculates age between two dates
- `dob_from_chi()` extracts Date of Birth (DoB) from the CHI number
- `age_from_chi()` extracts age from the CHI number
`phsmethods` can be used on both the PHS server and desktop versions of RStudio.
## Installation
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:
``` r
install.packages("phsmethods")
```
To install `phsmethods` directly from GitHub, the package `remotes` is required, and can be
installed with `install.packages("remotes")`.
You can then install `phsmethods` from GitHub with:
``` r
remotes::install_github("Public-Health-Scotland/phsmethods")
```
However, network security settings may prevent `remotes::install_github()` from
working on RStudio desktop. If this is the case, `phsmethods` can be
installed by downloading the [zip of the
repository](https://github.com/Public-Health-Scotland/phsmethods/archive/master.zip)
and running the following code (replacing the section marked `<>`,
including the arrows themselves):
``` r
remotes::install_local("/phsmethods-master.zip",
upgrade = "never"
)
```
## Using phsmethods
Load `phsmethods` using `library()`:
```{r load}
library(phsmethods)
```
To see the documentation for any `phsmethods`' functions, type `?function_name` into the RStudio console after loading the package:
```{r help, eval = FALSE}
?extract_fin_year
?format_postcode
```
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.
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.
## Contributing to phsmethods
At present, the maintainer of this package is [Tina Fu](https://github.com/Tina815).
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.
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.
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.
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).
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.
`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:
- All function names should be in lower case, with words separated by an underscore
- Put a space after a comma, never before
- Put a space before and after infix operators such as `<-`, `==` and `+`
- Limit code to 80 characters per line
- Function documentation should be generated using [`roxygen2`](https://github.com/r-lib/roxygen2)
- All functions should be tested using [`testthat`](https://github.com/r-lib/testthat)
- The package should always pass `devtools::check()`
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.
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.
Owner
- Name: Public Health Scotland
- Login: Public-Health-Scotland
- Kind: organization
- Email: phs.transformingpublishing@phs.scot
- Website: https://publichealthscotland.scot/
- Twitter: p_h_s_official
- Repositories: 38
- Profile: https://github.com/Public-Health-Scotland
GitHub Events
Total
- Issues event: 4
- Watch event: 1
- Delete event: 4
- Issue comment event: 18
- Push event: 45
- Pull request review comment event: 2
- Pull request event: 9
- Pull request review event: 6
- Create event: 7
Last Year
- Issues event: 4
- Watch event: 1
- Delete event: 4
- Issue comment event: 18
- Push event: 45
- Pull request review comment event: 2
- Pull request event: 9
- Pull request review event: 6
- Create event: 7
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jack Hannah | j****1@n****t | 189 |
| James McMahon | j****n@p****t | 147 |
| Tina Fu | y****2@p****t | 49 |
| Jaime Villacampa | j****a@n****t | 37 |
| David Caldwell | d****1@n****t | 35 |
| chrisdeans | c****s@n****t | 15 |
| CiaraGribben | c****n@n****t | 14 |
| JoKPro | j****p@e****e | 13 |
| James McMahon | j****1@n****t | 9 |
| graemegowans | g****5@g****m | 6 |
| Tina815 | t****u@n****t | 6 |
| David Caldwell | 3****2 | 4 |
| Nick Christofides | 7****r | 3 |
| Russell McCreath | 3****h | 2 |
| alicebyers5 | a****s@n****t | 1 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 50
- Total pull requests: 97
- Average time to close issues: 11 months
- Average time to close pull requests: about 1 month
- Total issue authors: 18
- Total pull request authors: 15
- Average comments per issue: 2.14
- Average comments per pull request: 1.2
- Merged pull requests: 78
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 5
- Pull requests: 11
- Average time to close issues: 3 months
- Average time to close pull requests: 3 months
- Issue authors: 3
- Pull request authors: 2
- Average comments per issue: 0.6
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Moohan (21)
- Nic-Chr (8)
- lucindalawrie (2)
- jackhannah95 (2)
- graemegowans (2)
- chrisdeans (2)
- catherineperkins (1)
- peterhall001 (1)
- terrymclaughlin (1)
- jvillacampa (1)
- RosalynLP (1)
- JonMinton (1)
- alice-hannah (1)
- Andrew-Saul (1)
- r6lm (1)
Pull Request Authors
- Moohan (58)
- jackhannah95 (10)
- Tina815 (9)
- davidc92 (7)
- github-actions[bot] (4)
- Nic-Chr (3)
- graemegowans (2)
- rmccreath (2)
- chrisdeans (1)
- simonq01 (1)
- jvillacampa (1)
- ciarag01 (1)
- JoKPro (1)
- IainMcl (1)
- alice-hannah (1)
Top Labels
Issue Labels
enhancement (13)
good first issue (3)
documentation (1)
help wanted (1)
Pull Request Labels
enhancement (11)
Maintainance (10)
documentation (7)
bug (2)
Packages
- Total packages: 1
-
Total downloads:
- cran 206 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: phsmethods
Standard Methods for Use in Public Health Scotland
- Homepage: https://github.com/Public-Health-Scotland/phsmethods
- Documentation: http://cran.r-project.org/web/packages/phsmethods/phsmethods.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 1.0.2
published over 2 years ago
Rankings
Forks count: 6.3%
Stargazers count: 6.6%
Dependent repos count: 23.9%
Average: 25.7%
Dependent packages count: 28.7%
Downloads: 63.2%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- dplyr * imports
- gdata * imports
- glue * imports
- lifecycle * imports
- lubridate * imports
- magrittr * imports
- purrr * imports
- readr * imports
- rlang * imports
- stringr * imports
- tibble * imports
- utils * imports
- covr * suggests
- here * suggests
- spelling * suggests
- testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/document.yaml
actions
- actions/checkout v3 composite
- peter-evans/create-pull-request v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/lint.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/render-README.yaml
actions
- actions/checkout v3 composite
- peter-evans/create-pull-request v4 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/style.yaml
actions
- actions/cache v3 composite
- actions/checkout v3 composite
- peter-evans/create-pull-request v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite