Skip to content

Commit

Permalink
Merge branch 'production' into amend_get_chi
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennit07 authored Dec 12, 2023
2 parents 1bc105f + 7f98dc7 commit 3e17ef7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ knitr::opts_chunk$set(

# slfhelper

The goal of slfhelper is to provide some easy-to-use functions that make working with the Source Linkage Files as painless and efficient as possible.
The goal of slfhelper is to provide some easy-to-use functions that make working with the Source Linkage Files as painless and efficient as possible. It is only intended for use by PHS employees and will only work on the PHS R infrastructure.

## Installation

The preferred method of installation is to use the [{`pak`} package](https://pak.r-lib.org/), which does an excellent job of handling the errors which sometimes occur.
The simplest way to install to the PHS Posit Workbench environment is to use the [PHS Package Manager](https://ppm.publichealthscotland.org/client/#/repos/3/packages/slfhelper), this will be the default setting and means you can install `slfhelper` as you would any other package.

```{r package_install}
``` {r package_install_ppm}
install.packages("slfhelper")
```

If this doesn't work you can install it directly from GitHub, there are a number of ways to do this, we recommend the [{`pak`} package](https://pak.r-lib.org/).

```{r package_install_github}
# Install pak (if needed)
install.packages("pak")
Expand All @@ -41,9 +47,9 @@ pak::pak("Public-Health-Scotland/slfhelper")

### Read a file

**Note:** Reading a full file is quite slow and will use a lot of memory, we would always recommend doing a column selection to only keep the variables that you need for your analysis. Just doing this will dramatically speed up the read-time.
**Note:** Reading a full file is quite slow and will use a lot of memory, we would always recommend doing a column selection to only keep the variables that you need for your analysis. Just doing this will dramatically speed up the read time.

We provide some data snippets to help with the column selection and filtering.
We provide some data snippets to help with column selection and filtering.

```{r helper_data}
library(slfhelper)
Expand Down Expand Up @@ -99,11 +105,11 @@ ep_1718 <- read_slf_episode(c("1718", "1819", "1920"),
) %>%
get_chi()
# Change chi numbers from data above back to anon_chi
# Change chi numbers from the data above back to anon_chi
ep_1718_anon <- ep_1718 %>%
get_anon_chi(chi_var = "chi")
# Add anon_chi to cohort sample
# Add anon_chi to the cohort sample
chi_cohort <- chi_cohort %>%
get_anon_chi(chi_var = "upi_number")
```

0 comments on commit 3e17ef7

Please sign in to comment.