Contributor Covenant Code of Conduct
- Source:.github/CODE_OF_CONDUCT.md
+ Source: .github/CODE_OF_CONDUCT.md
slf-documentation
- Source:vignettes/slf-documentation.Rmd
+ Source: vignettes/slf-documentation.Rmd
slf-documentation.Rmd
Memory usage in SLFSIndividual File
If one can use selection features in SLFhelper, the session memory
-requirement can be reduced. There are 263 columns for a year episode
+requirement can be reduced. There are 251 columns for a year episode
file of size around 20 GiB. Hence, on average, a column with all rows
takes around 0.1 GiB, which can give a rough estimate on the session
memory one needs. Taking Year 1920 as a demonstration, the following
diff --git a/articles/slfhelper-applications.html b/articles/slfhelper-applications.html
index bc8134e..b564643 100644
--- a/articles/slfhelper-applications.html
+++ b/articles/slfhelper-applications.html
@@ -62,7 +62,7 @@
slfhelper-applications
- Source: vignettes/slfhelper-applications.Rmd
+ Source: vignettes/slfhelper-applications.Rmd
slfhelper-applications.Rmd
slfhelper-applications.Rmd
Using Parquet files with the arrow package
- Source:vignettes/using-arrow-table.Rmd
+ Source: vignettes/using-arrow-table.Rmd
using-arrow-table.Rmd
Using variable packs
- Source:vignettes/variable-packs.Rmd
+ Source: vignettes/variable-packs.Rmd
variable-packs.Rmd
Looking up variable names
# Show the first few variables from the episode file
head(ep_file_vars)
-#> [1] "year" "recid" "anon_chi"
-#> [4] "postcode" "dd_responsible_lca" "record_keydate1"
+#> [1] "year" "recid" "record_keydate1" "record_keydate2"
+#> [5] "smrtype" "anon_chi"
# Do the same for the individual file
head(indiv_file_vars)
diff --git a/authors.html b/authors.html
index ac3498f..dba3c5a 100644
--- a/authors.html
+++ b/authors.html
@@ -65,7 +65,7 @@ Authors
Citation
- Source: DESCRIPTION
+ Source: DESCRIPTION
McMahon J, McNicol M, Li Z, Thom J (2024).
slfhelper: Useful functions for working with the Source Linkage Files.
diff --git a/news/index.html b/news/index.html
index 01b47dd..49d3309 100644
--- a/news/index.html
+++ b/news/index.html
@@ -36,7 +36,7 @@
diff --git a/pkgdown.yml b/pkgdown.yml
index 39f9487..1855862 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -6,7 +6,7 @@ articles:
slfhelper-applications: slfhelper-applications.html
using-arrow-table: using-arrow-table.html
variable-packs: variable-packs.html
-last_built: 2024-09-13T09:22Z
+last_built: 2024-09-13T15:14Z
urls:
reference: https://public-health-scotland.github.io/slfhelper/reference
article: https://public-health-scotland.github.io/slfhelper/articles
diff --git a/reference/check_has_access.html b/reference/check_has_access.html
index 9978256..b179e56 100644
--- a/reference/check_has_access.html
+++ b/reference/check_has_access.html
@@ -36,7 +36,7 @@
Check if the current user is in a UNIX group
- Source: R/zzz.R
+ Source: R/zzz.R
check_has_access.Rd
diff --git a/reference/check_on_server.html b/reference/check_on_server.html
index f715c2a..463aa8d 100644
--- a/reference/check_on_server.html
+++ b/reference/check_on_server.html
@@ -36,7 +36,7 @@
diff --git a/reference/check_year.html b/reference/check_year.html
index c15726b..7d1bb60 100644
--- a/reference/check_year.html
+++ b/reference/check_year.html
@@ -36,7 +36,7 @@
Check the year(s) supplied are valid
- Source: R/check_year.R
+ Source: R/check_year.R
check_year.Rd
diff --git a/reference/chi_cohort.html b/reference/chi_cohort.html
index 06bf8f2..df297ec 100644
--- a/reference/chi_cohort.html
+++ b/reference/chi_cohort.html
@@ -42,7 +42,7 @@
A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid.
- Source: R/data.R
+ Source: R/data.R
chi_cohort.Rd
diff --git a/reference/demog_vars.html b/reference/demog_vars.html
index 30088ca..bea5998 100644
--- a/reference/demog_vars.html
+++ b/reference/demog_vars.html
@@ -36,7 +36,7 @@
diff --git a/reference/ep_file_bedday_vars.html b/reference/ep_file_bedday_vars.html
index d589d05..af6907a 100644
--- a/reference/ep_file_bedday_vars.html
+++ b/reference/ep_file_bedday_vars.html
@@ -40,7 +40,7 @@
diff --git a/reference/ep_file_cost_vars.html b/reference/ep_file_cost_vars.html
index f065d98..a19a833 100644
--- a/reference/ep_file_cost_vars.html
+++ b/reference/ep_file_cost_vars.html
@@ -40,7 +40,7 @@
diff --git a/reference/ep_file_vars.html b/reference/ep_file_vars.html
index 44030a6..8cc7bcb 100644
--- a/reference/ep_file_vars.html
+++ b/reference/ep_file_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/format_year.html b/reference/format_year.html
index 300fbfb..3a2404b 100644
--- a/reference/format_year.html
+++ b/reference/format_year.html
@@ -36,7 +36,7 @@
Format a year into the correct short FY format
- Source: R/format_year.R
+ Source: R/format_year.R
format_year.Rd
diff --git a/reference/gen_file_path.html b/reference/gen_file_path.html
index 2dc6c09..f3461c3 100644
--- a/reference/gen_file_path.html
+++ b/reference/gen_file_path.html
@@ -36,7 +36,7 @@
Generate a Source Linkage File, file path
- Source: R/gen_file_path.R
+ Source: R/gen_file_path.R
gen_file_path.Rd
diff --git a/reference/get_anon_chi.html b/reference/get_anon_chi.html
index 91b0788..da48cd6 100644
--- a/reference/get_anon_chi.html
+++ b/reference/get_anon_chi.html
@@ -36,7 +36,7 @@
Match on anon_chi to a dataset using CHI numbers
- Source: R/get_anon_chi.R
+ Source: R/get_anon_chi.R
get_anon_chi.Rd
diff --git a/reference/get_chi.html b/reference/get_chi.html
index 8f1c2dc..b75c3dc 100644
--- a/reference/get_chi.html
+++ b/reference/get_chi.html
@@ -36,7 +36,7 @@
Match on CHI numbers to a dataset using anon_chi
- Source: R/get_chi.R
+ Source: R/get_chi.R
get_chi.Rd
diff --git a/reference/indiv_file_vars.html b/reference/indiv_file_vars.html
index 1dc7a3b..d698d66 100644
--- a/reference/indiv_file_vars.html
+++ b/reference/indiv_file_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/ltc_vars.html b/reference/ltc_vars.html
index 6489636..3f57a7a 100644
--- a/reference/ltc_vars.html
+++ b/reference/ltc_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/partnerships.html b/reference/partnerships.html
index 2edf45d..b765986 100644
--- a/reference/partnerships.html
+++ b/reference/partnerships.html
@@ -40,7 +40,7 @@
diff --git a/reference/pipe.html b/reference/pipe.html
index 284e25b..7dfba9e 100644
--- a/reference/pipe.html
+++ b/reference/pipe.html
@@ -36,7 +36,7 @@
diff --git a/reference/read_slf.html b/reference/read_slf.html
index 8086de7..aa4168d 100644
--- a/reference/read_slf.html
+++ b/reference/read_slf.html
@@ -36,7 +36,7 @@
diff --git a/reference/read_slf_episode.html b/reference/read_slf_episode.html
index 5e508e6..cfad0ba 100644
--- a/reference/read_slf_episode.html
+++ b/reference/read_slf_episode.html
@@ -36,7 +36,7 @@
Read a Source Linkage episode file
- Source: R/read_slf.R
+ Source: R/read_slf.R
read_slf_episode.Rd
diff --git a/reference/read_slf_individual.html b/reference/read_slf_individual.html
index a691635..8f9c069 100644
--- a/reference/read_slf_individual.html
+++ b/reference/read_slf_individual.html
@@ -36,7 +36,7 @@
Read a Source Linkage individual file
- Source: R/read_slf.R
+ Source: R/read_slf.R
read_slf_individual.Rd
diff --git a/reference/recids.html b/reference/recids.html
index c89238f..44841a8 100644
--- a/reference/recids.html
+++ b/reference/recids.html
@@ -40,7 +40,7 @@
diff --git a/reference/slfhelper-package.html b/reference/slfhelper-package.html
index 067d7c8..75ce3e6 100644
--- a/reference/slfhelper-package.html
+++ b/reference/slfhelper-package.html
@@ -36,7 +36,7 @@
slfhelper: Useful functions for working with the Source Linkage Files
- Source: R/slfhelper-package.R
+ Source: R/slfhelper-package.R
slfhelper-package.Rd
diff --git a/search.json b/search.json
index d544407..e084a35 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to slfhelper","title":"Contributing to slfhelper","text":"outlines propose change slfhelper.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to slfhelper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to slfhelper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to slfhelper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"Public-Health-Scotland/slfhelper\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to slfhelper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to slfhelper","text":"Please note slfhelper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2019 James McMahon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with slfhelper","title":"Getting help with slfhelper","text":"Thanks using slfhelper! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with slfhelper","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with slfhelper","text":"Armed reprex, next step figure ask. ’s question: start SLF Teams channel. ’s bug: ’re right place, file issue. ’re sure: feel free either! opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"slfhelper","dir":"Articles","previous_headings":"","what":"SLFhelper","title":"slf-documentation","text":"SLFhelper contains easy use functions designed make working Source Linkage Files (SLFs) efficient possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"filter-functions","dir":"Articles","previous_headings":"SLFhelper","what":"Filter functions:","title":"slf-documentation","text":"year returns financial year interest. can also select multiple years using c(\"1718\", \"1819\", \"1920\") recid returns recids interest. Selecting beneficial specific analysis. partnerships returns partnerships interest. Selecting certain partnerships reduce SLFs size. col_select returns columns interest. best way reduce SLFs size.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"data-snippets","dir":"Articles","previous_headings":"SLFhelper","what":"Data snippets:","title":"slf-documentation","text":"ep_file_vars returns list variables episode files. indiv_file_vars returns list variables individual files. partnerships returns list partnership names (HSCP_2018 codes) recid returns list recids available SLFs. ep_file_bedday_vars returns list bedday related variables SLFs. ep_file_cost_vars returns list cost related variables SLFs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"anon-chi","dir":"Articles","previous_headings":"SLFhelper","what":"Anon CHI","title":"slf-documentation","text":"Use function get_chi() easily switch anon_chi chi. Use function get_anon_chi() easily switch chi anon_chi.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"memory-usage-in-slfs","dir":"Articles","previous_headings":"SLFhelper","what":"Memory usage in SLFS","title":"slf-documentation","text":"working Source Linkage Files (SLFs), recommended use features SLFhelper package maximase memory usage posit, see PHS Data Science Knowledge Base guidance memory usage posit workbench. Reading full SLF file can time consuming take resources posit workbench. episode file 263 variables around 12 million rows compared individual file 205 variables around 6 million rows file. can reduced using available selections SLFhelper help reduce size SLFs analysis free resources posit workbench. tables show memory usage full size SLF.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"individual-file","dir":"Articles","previous_headings":"SLFhelper > Memory usage in SLFS","what":"Individual File","title":"slf-documentation","text":"one can use selection features SLFhelper, session memory requirement can reduced. 263 columns year episode file size around 20 GiB. Hence, average, column rows takes around 0.1 GiB, can give rough estimate session memory one needs. Taking Year 1920 demonstration, following tables present various sizes extracts SLF files, 5 columns columns, along amount memory required work data one reads . Keep mind tables just recommendations, memory usage depends one handles data optimises data pipeline.","code":""},{"path":[]},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slfhelper-applications.html","id":"examples-using-slfhelper","dir":"Articles","previous_headings":"","what":"Examples using SLFhelper","title":"slfhelper-applications","text":"&E attendances East Lothian age group. Produce table compare &E Attendances following age groups (0-17, 18-64, 65-74, 75-84, 85+) 2018/19 East Lothian HSCP. Outpatient attendances specialty gender. Create table compare number outpatient attendances (SMR00) broken specialty gender 2017/18 Scotland. Hospital admissions & beddays HB residence. Produce table compare number admissions, bed days average length stay (split elective non-elective) Health Board Residence 2018/19. GP Hours Consulations South Ayrshire. Create table showing number GP Hours consultations patients dementia South Ayrshire HSCP 2019/20 broken type consultation. Costs Aberdeen City. Produce table show number patients total costs Aberdeen City HSCP 2018/19. Include breakdown costs following services: Acute (inpatients & daycases), GLS, Mental Health Maternity, Outpatients, &E, GP Hours, Community Prescribing. Deaths Dementia / Alzheimers Produce chart show number deaths 2015/16 2019/20 Scotland main cause death recorded Dementia/Alzheimers (ICD 10 codes: G30, F01-F03, F05.1). Number cost prescriptions MS Create table compare number cost prescribed items patients Multiple Sclerosis (MS) HSCP 2018/19. Include number dispensed items cost per patient. &E attendance last 3 months life. Produce table show number deaths Glasgow City HSCP 2019/20 proportion &E attendance last 3 months life. Non elective admissions Geriatric Medicine. Create table showing number non-elective admissions part stay (Continuous Inpatient Journey, CIJ) specialty Geriatric Medicine, HSCP 2019/20. Also include associated bed days, cost number patients.","code":"# read in data required from slf individual file - filter for year 2018/19 el_1819 <- read_slf_individual( year = \"1819\", # select variables needed col_select = c(\"age\", \"ae_attendances\"), # filter partnership for East Lothian partnerships = \"S37000010\" ) # create age bands age_labs <- c(\"0-17\", \"18-64\", \"65-74\", \"75-84\", \"85+\") # create age labels # create age group variable el_1819 <- el_1819 %>% mutate(age_group = cut(age, breaks = c(-1, 17, 64, 74, 84, 150), labels = age_labs )) # produce summary table output_table_1 <- el_1819 %>% group_by(age_group) %>% summarise(attendances = sum(ae_attendances)) %>% ungroup() # read in specialty lookup with names spec_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/National Reference Files/Specialty.csv\") %>% select( spec = Speccode, spec_name = Description ) # read in data required from slf episode file - filter year = 2017/18 op_1718 <- read_slf_episode( year = \"1718\", # select columns col_select = c(\"recid\", \"gender\", \"spec\"), # filter on recid for outpatients recids = \"00B\" ) # produce output output_table_2 <- op_1718 %>% # get counts by specialty and gender count(spec, gender) %>% # exclude those with no gender recorded filter(gender == 1 | gender == 2) %>% # recode gender into M/F mutate(gender = recode(as.character(gender), \"1\" = \"Male\", \"2\" = \"Female\")) %>% # move gender to separate columns pivot_wider(names_from = gender, values_from = n) %>% # match on specialty names left_join(spec_lookup) %>% # reorder variables select(spec, spec_name, Male, Female) # Read in names for Health Boards hb_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Health Board Area 2019 Lookup.csv\") %>% select( hb2019 = HealthBoardArea2019Code, hb_desc = HealthBoardArea2019Name ) # read in data required from slf individual file - filter for 2018/19 indiv_1819 <- read_slf_individual( year = \"1819\", # Select columns of interest col_select = c( \"hb2019\", \"cij_el\", \"cij_non_el\", \"acute_el_inpatient_beddays\", \"mh_el_inpatient_beddays\", \"gls_el_inpatient_beddays\", \"acute_non_el_inpatient_beddays\", \"mh_non_el_inpatient_beddays\", \"gls_non_el_inpatient_beddays\" ) ) # calculate total bed days and add on HB names indiv_1819_inc_totals <- indiv_1819 %>% # calculate overall bed days mutate( elective_beddays = acute_el_inpatient_beddays + mh_el_inpatient_beddays + gls_el_inpatient_beddays, non_elective_beddays = acute_non_el_inpatient_beddays + mh_non_el_inpatient_beddays + gls_non_el_inpatient_beddays ) %>% # match on HB name left_join(hb_lookup) # produce summary table output_table_3 <- indiv_1819_inc_totals %>% # group by HB of residence group_by(hb2019, hb_desc) %>% # produce summary table summarise( elective_adm = sum(cij_el), non_elective_adm = sum(cij_non_el), elective_beddays = sum(elective_beddays), non_elective_beddays = sum(non_elective_beddays) ) %>% # calculate average length of stay mutate( elective_alos = elective_beddays / elective_adm, non_elective_alos = non_elective_beddays / non_elective_adm ) # read in data required from slf episode file - filter for year = 2019/20 sa_1920 <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"dementia\", \"smrtype\"), # filter for South Ayrshire HSCP partnerships = \"S37000027\", # Filter for GP OOH data recids = \"OoH\" ) # select dementia patients sa_dementia_1920 <- sa_1920 %>% filter(dementia == 1) # produce summary table output_table_4 <- sa_dementia_1920 %>% count(smrtype) # read in data required from slf individual file - filter year = 2018/19 ab_1819 <- read_slf_individual( year = \"1819\", # select columns col_select = c( \"acute_cost\", \"gls_cost\", \"mh_cost\", \"mat_cost\", \"op_cost_attend\", \"ae_cost\", \"ooh_cost\", \"pis_cost\", \"health_net_cost\" ), # filter for Aberdeen City partnerships = \"S37000001\" ) # Have used variables which exclude the cost of outpatient attendances which did # not attend (DNA) but you could also include this if needed. # produce summary table output_table_5 <- ab_1819 %>% # rename outatients variable rename(op_cost = op_cost_attend) %>% # sum of all cost variables and number of patients summarise(across(ends_with(\"_cost\"), ~ sum(.x, na.rm = TRUE)), patients = n() ) %>% # switch to rows pivot_longer(everything()) # read in data required from slf episode file - filter for years 2015/16 to 2019/20 deaths <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\", \"1920\"), # select columns col_select = c(\"year\", \"deathdiag1\"), # Filter for death records recids = \"NRS\" ) # extract 3 & 4 digit codes and select those with dementia dementia_deaths <- deaths %>% # extract 3 & 4 digit ICD 10 codes mutate( diag_3d = str_sub(deathdiag1, 1, 3), diag_4d = str_sub(deathdiag1, 1, 4) ) %>% # select dementia codes filter(diag_3d == \"G30\" | diag_3d == \"F00\" | diag_3d == \"F01\" | diag_3d == \"F02\" | diag_3d == \"F03\" | diag_4d == \"F051\") # produce summary table output_table_6 <- dementia_deaths %>% count(year) %>% rename(deaths = n) # read in HSCP names (used in exercises 7 & 9) hscp_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Integration Authority 2019 Lookup.csv\") %>% select( hscp2019 = IntegrationAuthority2019Code, hscp_desc = IntegrationAuthority2019Name ) # read in data required from slf episode file - filter for year = 2018/19 pis_1819 <- read_slf_individual(\"1819\", col_select = c(\"hscp2019\", \"ms\", \"pis_paid_items\", \"pis_cost\") ) # select all patients with MS & add on HSCP name ms_1819 <- pis_1819 %>% filter(ms == 1) %>% left_join(hscp_lookup) # produce summary table output_table_7 <- ms_1819 %>% # group by hscp group_by(hscp2019, hscp_desc) %>% # sum up number of items, costs & patients with MS (not all will have had prescription) summarise( pis_paid_items = sum(pis_paid_items), pis_cost = sum(pis_cost), patients = sum(ms) ) %>% ungroup() %>% # calculate number of items / cost per patient mutate( items_per_patient = pis_paid_items / patients, cost_per_patient = pis_cost / patients ) # extract all deaths in Glasgow City in 1920 - Filter year = 1920 gc_deaths <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"anon_chi\", \"death_date\"), # filter for Glasgow City partnerships = \"S37000015\", # Filter for death records recids = \"NRS\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # exclude duplicates distinct(anon_chi, death_date) # extract all A&E attendances in 1819 & 1920 ae <- read_slf_episode( year = c(\"1819\", \"1920\"), # select columns col_select = c(\"anon_chi\", \"recid\", \"record_keydate1\"), # filter for A&E data recids = \"AE2\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # rename date of attendance rename(attendance_date = record_keydate1) # select A&E attendances for those individuals who are in the GC deaths file ae_gc <- ae %>% # filter A&E attendances for those in deaths file semi_join(gc_deaths) %>% # match on date of death left_join(gc_deaths) # select A&E attendances which are within 3 months of death (counted as 91 days) ae_gc_3m <- ae_gc %>% # create 3 month interval mutate(int_3m = interval(death_date - days(91), death_date)) %>% # flag if attendance is in 3 month interval mutate(att_3m = if_else(attendance_date %within% int_3m, 1, 0)) %>% # select only those attendances in 3 months before death filter(att_3m == 1) # create list of patients with A&E attendance in 3m period pats_ae_3m <- ae_gc_3m %>% # select only chi and attendance flag select(anon_chi, att_3m) %>% # restrict to one row per person distinct() # final output for total number of deaths and number with an A&E attendance in last 3 months output_table_8 <- gc_deaths %>% # match on attendance flag left_join(pats_ae_3m) %>% # summarise total deaths and deaths with A&E attendance in last 3 months summarise( deaths = n(), deaths_with_ae_att = sum(att_3m, na.rm = TRUE) ) %>% # calculate % mutate(prop_ae_3m = deaths_with_ae_att / deaths) # extract data required from episode file smr_1920 <- read_slf_episode( year = \"1920\", col_select = c( \"anon_chi\", \"record_keydate1\", \"record_keydate2\", \"spec\", \"hscp2019\", \"yearstay\", \"cost_total_net\", \"cij_marker\", \"cij_pattype\" ), recids = c(\"01B\", \"GLS\", \"04B\") ) %>% # exclude those with missing chi filter(anon_chi != \"\") # flag episodes in Geriatric Medicine specialty AB smr_1920 <- smr_1920 %>% mutate(ger_med = if_else(spec == \"AB\", 1, 0)) # select only those from non-elective stays smr_1920_ne <- smr_1920 %>% filter(cij_pattype == \"Non-Elective\") # aggregate to cij level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost cij_1920 <- smr_1920_ne %>% arrange(anon_chi, cij_marker, record_keydate1, record_keydate2) %>% group_by(anon_chi, cij_marker) %>% summarise( across(record_keydate1, min), across(c(record_keydate2, ger_med), max), across(c(cij_pattype, hscp2019), last), across(c(yearstay, cost_total_net), sum) ) %>% ungroup() # select only admissions with part of their stay in Geriatric Medicine specialty cij_ger_med <- cij_1920 %>% filter(ger_med == 1) # aggregate up to patient level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost pat_1920 <- cij_ger_med %>% group_by(anon_chi, hscp2019) %>% summarise( across(c(ger_med, yearstay, cost_total_net), sum) ) %>% ungroup() # produce output # note patients may be counted in more than one hscp output_table_9 <- pat_1920 %>% # match on hscp names left_join(hscp_lookup) %>% # group up to hscp level group_by(hscp2019, hscp_desc) %>% # sum up measures summarise( admissions = sum(ger_med), beddays = sum(yearstay), cost = sum(cost_total_net), patients = n() ) %>% ungroup()"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"using-parquet-files-with-the-arrow-package","dir":"Articles","previous_headings":"","what":"Using Parquet files with the arrow package","title":"Using Parquet files with the arrow package","text":"SLFs available parquet format. {arrow} package gives extra features can speed reduce memory usage even . can read specific columns read_parquet(file, col_select = c(var1, var2)). Using arrow’s ‘Arrow Table’ feature, can speed analysis efficiently. , specify as_data_frame = FALSE using SLFhelper dplyr::collect() read data.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"for-example","dir":"Articles","previous_headings":"Using Parquet files with the arrow package","what":"For example:","title":"Using Parquet files with the arrow package","text":"Imagine scenario analysing planned unplanned beddays Scotland, two ways read episode files analysis setting as_data_frame TRUE FALSE follows. specifying as_data_frame = FALSE using reading SLF functions, one enjoys great advantages parquet files. One advantages fast query processing reading necessary columns rather entire rows. table demonstrates huge impact advantages. Comparison different ways reading SLF files","code":"library(slfhelper) ## FAST METHOD # Filter for year of interest slf_extract1 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = FALSE ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay)) %>% # collect the arrow table dplyr::collect() ## SLOW and DEFAULT Method # Filter for year of interest slf_extract2 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = TRUE # which is default ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-only-specified-variables","dir":"Articles","previous_headings":"","what":"Selecting only specified variables","title":"Using variable packs","text":"recommended choose variables need reading Source Linkage File. can achieved specifying col_select argument relevant read_slf_ function. result data read much faster well easy work . full episode individual files 200+ 100+ variables respectively!","code":"library(slfhelper) ep_data <- read_slf_episode(year = 1920, col_select = c(\"year\", \"anon_chi\", \"recid\")) indiv_data <- read_slf_individual(year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-variables-using-tidyselect-functions","dir":"Articles","previous_headings":"","what":"Selecting variables using tidyselect functions","title":"Using variable packs","text":"now allowed use tidyselect functions, contains() start_with(), select variables relevant read_slf_ function. One can also mix tidyselect functions specified variables selecting.","code":"library(slfhelper) ep_data <- read_slf_episode( year = 1920, col_select = !tidyselect::contains(\"keytime\") ) indiv_data <- read_slf_individual( year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\", tidyselect::starts_with(\"sds\")) )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"looking-up-variable-names","dir":"Articles","previous_headings":"","what":"Looking up variable names","title":"Using variable packs","text":"help task picking variables might need analysis, well getting spelling correct, provide lists variable names package.","code":"# Show the first few variables from the episode file head(ep_file_vars) #> [1] \"year\" \"recid\" \"anon_chi\" #> [4] \"postcode\" \"dd_responsible_lca\" \"record_keydate1\" # Do the same for the individual file head(indiv_file_vars) #> [1] \"anon_chi\" \"gender\" \"postcode\" #> [4] \"dob\" \"gpprac\" \"sc_latest_submission\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"variable-packs","dir":"Articles","previous_headings":"","what":"Variable packs","title":"Using variable packs","text":"great can still lot effort copy/pasting every time, especially need quite variables analysis. assist , number ‘variable packs’, groups variables commonly needed together can accessed simple name. Currently four packs; demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Let’s see contain.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"demographic-variables","dir":"Articles","previous_headings":"Variable packs","what":"Demographic variables","title":"Using variable packs","text":"demographic variables specific CHI can used episode individual file.","code":"demog_vars #> [1] \"anon_chi\" \"gender\" #> [3] \"dob\" \"age\" #> [5] \"gpprac\" \"hbpraccode\" #> [7] \"postcode\" \"hbrescode\" #> [9] \"hscp2018\" \"lca\" #> [11] \"ca2018\" \"locality\" #> [13] \"datazone2011\" \"hb2019\" #> [15] \"hscp2019\" \"ca2019\" #> [17] \"simd2020v2_rank\" \"simd2020v2_sc_decile\" #> [19] \"simd2020v2_sc_quintile\" \"simd2020v2_hb2019_decile\" #> [21] \"simd2020v2_hb2019_quintile\" \"simd2020v2_hscp2019_decile\" #> [23] \"simd2020v2_hscp2019_quintile\" \"ur8_2016\" #> [25] \"ur6_2016\" \"ur3_2016\" #> [27] \"ur2_2016\" \"cluster\" #> [29] \"demographic_cohort\" \"service_use_cohort\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"long-term-condition-ltc-variables","dir":"Articles","previous_headings":"Variable packs","what":"Long Term Condition (LTC) variables","title":"Using variable packs","text":"Long Term Condition flag variables specific CHI can used episode individual file.","code":"ltc_vars #> [1] \"arth\" \"asthma\" \"atrialfib\" \"cancer\" \"cvd\" #> [6] \"liver\" \"copd\" \"dementia\" \"diabetes\" \"epilepsy\" #> [11] \"chd\" \"hefailure\" \"ms\" \"parkinsons\" \"refailure\" #> [16] \"congen\" \"bloodbfo\" \"endomet\" \"digestive\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"bedday-variables","dir":"Articles","previous_headings":"Variable packs","what":"Bedday variables","title":"Using variable packs","text":"variables detailing beddays, specific episode can used episode file.","code":"ep_file_bedday_vars #> [1] \"yearstay\" \"stay\" \"apr_beddays\" \"may_beddays\" \"jun_beddays\" #> [6] \"jul_beddays\" \"aug_beddays\" \"sep_beddays\" \"oct_beddays\" \"nov_beddays\" #> [11] \"dec_beddays\" \"jan_beddays\" \"feb_beddays\" \"mar_beddays\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"cost-variables","dir":"Articles","previous_headings":"Variable packs","what":"Cost variables","title":"Using variable packs","text":"variables detailing costs, specific episode can used episode file.","code":"ep_file_cost_vars #> [1] \"cost_total_net\" \"cost_total_net_inc_dnas\" #> [3] \"apr_cost\" \"may_cost\" #> [5] \"jun_cost\" \"jul_cost\" #> [7] \"aug_cost\" \"sep_cost\" #> [9] \"oct_cost\" \"nov_cost\" #> [11] \"dec_cost\" \"jan_cost\" #> [13] \"feb_cost\" \"mar_cost\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"using-variable-packs","dir":"Articles","previous_headings":"","what":"Using variable packs","title":"Using variable packs","text":"variable packs can used column selection simplify code substantially. example take demographic data LTC flags individual file. get bedday information Acute records episode file.","code":"library(slfhelper) indiv_ltc_data <- read_slf_individual(year = 1920, col_select = c(\"year\", demog_vars, ltc_vars)) library(slfhelper) acute_beddays <- read_slf_episode( year = 1920, col_select = c(\"year\", \"anon_chi\", \"hbtreatcode\", \"recid\", ep_file_bedday_vars, \"cij_pattype\"), recid = c(\"01B\", \"GLS\") )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Using variable packs","text":"using column argument reading data increase read speed, reduce amount data loading R. slfhelper provides number helpers make picking using variables need easier. like changes made existing packs, please open issue GitHub. like suggest additional variable packs, either open issue, even submit pull request!","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Public Health Scotland. Copyright holder. James McMahon. Author. Megan McNicol. Maintainer, author. Zihao Li. Author. Jennifer Thom. Author.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"McMahon J, McNicol M, Li Z, Thom J (2024). slfhelper: Useful functions working Source Linkage Files. R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper, https://public-health-scotland.github.io/slfhelper/.","code":"@Manual{, title = {slfhelper: Useful functions for working with the Source Linkage Files}, author = {James McMahon and Megan McNicol and Zihao Li and Jennifer Thom}, year = {2024}, note = {R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper}, url = {https://public-health-scotland.github.io/slfhelper/}, }"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper","dir":"","previous_headings":"","what":"Useful functions for working with the Source Linkage Files","title":"Useful functions for working with the Source Linkage Files","text":"goal slfhelper provide easy--use functions make working Source Linkage Files painless efficient possible. intended use PHS employees work PHS R infrastructure.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Useful functions for working with the Source Linkage Files","text":"simplest way install PHS Posit Workbench environment use PHS Package Manager, default setting means can install slfhelper package. doesn’t work can install directly GitHub, number ways , recommend {pak} package.","code":"install.packages(\"slfhelper\") # Install pak (if needed) install.packages(\"pak\") # Use pak to install slfhelper pak::pak(\"Public-Health-Scotland/slfhelper\")"},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper-articles","dir":"","previous_headings":"Additional Documentation","what":"SLFhelper Articles","title":"Useful functions for working with the Source Linkage Files","text":"created additional documentation help using SLFhelper. new documentation can found : https://public-health-scotland.github.io/slfhelper/ selecting drop Articles. includes: * Memory usage using SLFs Posit * Using arrow package SLFs * Example questions answered using SLFs (full code available) find useful like see topics included future documentation, please get touch team.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"read-a-file","dir":"","previous_headings":"Usage","what":"Read a file","title":"Useful functions for working with the Source Linkage Files","text":"Note: Reading full file quite slow use lot memory, always recommend column selection keep variables need analysis. Just dramatically speed read time. provide data snippets help column selection filtering. options reading files can () combined required.","code":"library(slfhelper) # Get a list of the variables in a file ep_file_vars indiv_file_vars # See a lookup of Partnership names to HSCP_2018 codes View(partnerships) # See a list with descriptions for the recids View(recids) # See a list of Long term conditions View(ltc_vars) # See a list of bedday related variables View(ep_file_bedday_vars) # See a list of cost related variables View(ep_file_cost_vars) library(slfhelper) # Read a group of variables e.g. LTCs (arth, asthma, atrialfib etc) # A nice 'catch all' for reading in all of the LTC variables ep_1718 <- read_slf_episode(\"1718\", col_select = c(\"anon_chi\", ltc_vars)) # Read in a group of variables e.g. bedday related variables (yearstay, stay, apr_beddays etc) # A 'catch all' for reading in bedday related variables ep_1819 <- read_slf_episode(\"1819\", col_select = c(\"anon_chi\", ep_file_bedday_vars)) # Read in a group of variables e.g. cost related variables (cost_total_net, apr_cost) # A 'catch all' for reading in cos related variables ep_1920 <- read_slf_episode(\"1920\", col_select = c(\"anon_chi\", ep_file_cost_vars)) library(slfhelper) # Read certain variables # It's much faster to choose variables like this indiv_1718 <- read_slf_individual(year = \"1718\", col_select = c(\"anon_chi\", \"hri_scot\")) # Read multiple years # This will use dplyr::bind_rows() and return the files added together as a single tibble episode_data <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\"), col_select = c(\"anon_chi\", \"yearstay\") ) # Read only data for a certain partnership (HSCP_2018 code) # This can be a single partnership or multiple by supplying a vector e.g. c(...) indiv_1718 <- read_slf_individual( year = \"1718\", partnerships = \"S37000001\", # Aberdeen City col_select = c(\"anon_chi\", \"hri_scot\") ) # Read only data for a certain recid # This can be a single recid or multiple by supplying a vector e.g. c(...) ep_1718 <- read_slf_episode(\"1718\", recid = c(\"01B\", \"GLS\"), col_select = c(\"anon_chi\", \"yearstay\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"match-on-chi-numbers-to-anon_chi-or-vice-versa","dir":"","previous_headings":"Usage","what":"Match on CHI numbers to Anon_CHI (or vice versa)","title":"Useful functions for working with the Source Linkage Files","text":"","code":"library(slfhelper) # Add real CHI numbers to a SLF ep_1718 <- read_slf_episode(c(\"1718\", \"1819\", \"1920\"), col_select = c(\"year\", \"anon_chi\", \"demographic_cohort\") ) %>% get_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 the cohort sample chi_cohort <- chi_cohort %>% get_anon_chi(chi_var = \"upi_number\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the current user is in a UNIX group — check_has_access","title":"Check if the current user is in a UNIX group — check_has_access","text":"Check current user UNIX group","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the current user is in a UNIX group — check_has_access","text":"","code":"check_has_access(group = \"hscdiip\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the current user is in a UNIX group — check_has_access","text":"group group check, default hscdiip","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the current user is in a UNIX group — check_has_access","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if it's a server session — check_on_server","title":"Check if it's a server session — check_on_server","text":"Check server session","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if it's a server session — check_on_server","text":"","code":"check_on_server()"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if it's a server session — check_on_server","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Check the year(s) supplied are valid — check_year","title":"Check the year(s) supplied are valid — check_year","text":"Check year(s) supplied valid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check the year(s) supplied are valid — check_year","text":"","code":"check_year(year, call = rlang::caller_env())"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check the year(s) supplied are valid — check_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). call Supply environment top-level function make error messages useful.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check the year(s) supplied are valid — check_year","text":"TRUE year valid newer year, FALSE older still valid years. Otherwise throws error.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":null,"dir":"Reference","previous_headings":"","what":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"tibble containing example cohort CHI numbers different variable names. used testing illustrate examples. likely many 'chi numbers' valid.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"","code":"chi_cohort"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"object class tbl_df (inherits tbl, data.frame) 100 rows 2 columns.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Demographic variables — demog_vars","title":"Demographic variables — demog_vars","text":"vector containing names demographic variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Demographic variables — demog_vars","text":"","code":"demog_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Demographic variables — demog_vars","text":"object class character length 30.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file bedday variables — ep_file_bedday_vars","title":"Episode file bedday variables — ep_file_bedday_vars","text":"vector containing names bedday related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file bedday variables — ep_file_bedday_vars","text":"","code":"ep_file_bedday_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file bedday variables — ep_file_bedday_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file cost variables — ep_file_cost_vars","title":"Episode file cost variables — ep_file_cost_vars","text":"vector containing names cost related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file cost variables — ep_file_cost_vars","text":"","code":"ep_file_cost_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file cost variables — ep_file_cost_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file variables — ep_file_vars","title":"Episode file variables — ep_file_vars","text":"names variables episode files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file variables — ep_file_vars","text":"","code":"ep_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file variables — ep_file_vars","text":"object class character length 251.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a year into the correct short FY format — format_year","title":"Format a year into the correct short FY format — format_year","text":"Format year correct short FY format","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a year into the correct short FY format — format_year","text":"","code":"format_year(year)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a year into the correct short FY format — format_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year().","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format a year into the correct short FY format — format_year","text":"Year correctly formatted short FY e.g. '1718'","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Source Linkage File, file path — gen_file_path","title":"Generate a Source Linkage File, file path — gen_file_path","text":"Generate Source Linkage File, file path","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a Source Linkage File, file path — gen_file_path","text":"","code":"gen_file_path(year, file_version, call, dev = FALSE, ext = \"parquet\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a Source Linkage File, file path — gen_file_path","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). call Supply environment top-level function make error messages useful. dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. ext file extension read.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Source Linkage File, file path — gen_file_path","text":"fs_path object.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"Match anon_chi dataset using CHI numbers","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"get_anon_chi(chi_cohort, chi_var = \"chi\", drop = TRUE, check = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"chi_cohort tibble data frame. chi_var CHI variable: name variable containing CHI (default chi). drop Optional boolean indicating whether existing chi_var dropped - default TRUE. check Optional boolean, CHIs checked using phsmethods::chi_check() - default TRUE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"if (FALSE) { # \\dontrun{ chi_cohort %>% get_anon_chi() chi_cohort %>% get_anon_chi(chi_var = \"upi_number\") } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on CHI numbers to a dataset using anon_chi — get_chi","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"Match CHI numbers dataset using anon_chi","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"get_chi(data, anon_chi_var = \"anon_chi\", drop = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"data tibble data frame anon_chi_var Anon CHI variable: name variable containing anonymised CHI (default anon_chi) drop Optional boolean indicating whether existing anon_chi_var dropped - default TRUE","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"if (FALSE) { # \\dontrun{ slf_1718 <- read_slf_individual(\"1718\") get_chi(slf_1718) get_chi(slf_1718, drop = FALSE) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual file variables — indiv_file_vars","title":"Individual file variables — indiv_file_vars","text":"names variables individual files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual file variables — indiv_file_vars","text":"","code":"indiv_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Individual file variables — indiv_file_vars","text":"object class character length 193.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"LTC variables — ltc_vars","title":"LTC variables — ltc_vars","text":"vector containing names Long Term Condition (LTC) variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"LTC variables — ltc_vars","text":"","code":"ltc_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"LTC variables — ltc_vars","text":"object class character length 19.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":null,"dir":"Reference","previous_headings":"","what":"HSCP name / code lookup — partnerships","title":"HSCP name / code lookup — partnerships","text":"tibble containing names codes (hscp2018 configuration) partnerships. used partnership parameter reading files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"HSCP name / code lookup — partnerships","text":"","code":"partnerships"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"HSCP name / code lookup — partnerships","text":"tibble 31 rows 2 variables: partnership_name official name Partnership hscp2018 hscp2018 standard code S370000??","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage File — read_slf","title":"Read a Source Linkage File — read_slf","text":"Read Source Linkage File","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage File — read_slf","text":"","code":"read_slf( year, file_version = c(\"episode\", \"individual\"), dev = FALSE, col_select = NULL, columns = lifecycle::deprecated(), as_data_frame = TRUE, partnerships = NULL, recids = NULL )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage File — read_slf","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). columns columns longer used, use col_select instead. as_data_frame function return tibble (default) Arrow Table? partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage File — read_slf","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage episode file — read_slf_episode","title":"Read a Source Linkage episode file — read_slf_episode","text":"Read Source Linkage episode file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"read_slf_episode( year, col_select = NULL, partnerships = NULL, recids = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage episode file — read_slf_episode","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage episode file — read_slf_episode","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_episode(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\") ) read_slf_episode(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage individual file — read_slf_individual","title":"Read a Source Linkage individual file — read_slf_individual","text":"Read Source Linkage individual file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"read_slf_individual( year, col_select = NULL, partnerships = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage individual file — read_slf_individual","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage individual file — read_slf_individual","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_individual(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"hri_scot\") ) read_slf_individual(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"hri_scot\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":null,"dir":"Reference","previous_headings":"","what":"Recid name / description lookup — recids","title":"Recid name / description lookup — recids","text":"tibble containing names description recids. used recid parameter reading episode files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recid name / description lookup — recids","text":"","code":"recids"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Recid name / description lookup — recids","text":"tibble 18 rows 2 variables: recid short-form recid Description description recid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":null,"dir":"Reference","previous_headings":"","what":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"package provides helper functions working Source Linkage Files (SLFs). functions mainly focused making first steps analysis easier. can read filter files efficiently using minimal code.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"Maintainer: Megan McNicol megan.mcnicol2@phs.scot Authors: James McMahon james.mcmahon@phs.scot (ORCID) Zihao Li zihao.li@phs.scot (ORCID) Jennifer Thom jennifer.thom@phs.scot contributors: Public Health Scotland phs.source@phs.scot [copyright holder]","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0104","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.4","title":"slfhelper 0.10.4","text":"Bug - Fix build tests New feature - Additional documentation Update README.md Bug - Fix tidyselect feature bug","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0103","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.3","title":"slfhelper 0.10.3","text":"New feature - use tidyselect col_selectin read_slf_episode read_slf_individual.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0102","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.2","title":"slfhelper 0.10.2","text":"Update README.md change episode file cost variable vector force keytime format hms","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0101","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.1","title":"slfhelper 0.10.1","text":"Update README.Rmd Bug - speed get_chi()","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0100","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.0","title":"slfhelper 0.10.0","text":"{glue} longer dependency required functionality can provided `stringr::str_glue(). Dependency versions updated latest. get_chi() get_anon_chi() now properly match missing (NA) blank (\"\") values. slfhelper now defaults using .parquet file versions, old versions slfhelper longer work. now dev parameter available using read_slf_* functions allows reading file development environment.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-090","dir":"Changelog","previous_headings":"","what":"slfhelper 0.9.0","title":"slfhelper 0.9.0","text":"{openssl} now required. get_chi() get_anon_chi() now much faster (>100X) use significantly less memory. year parameter now checked early process, invalid year supplied error message much informative.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-082","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.2","title":"slfhelper 0.8.2","text":"ep_file_vars indiv_file_vars updated correct variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-081","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.1","title":"slfhelper 0.8.1","text":"Use cli nicer error messages warning.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-080","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.0","title":"slfhelper 0.8.0","text":"Add number ‘variable packs’ easily selecting sets variables: demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Add new vignette introducing variable packs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-071","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.1","title":"slfhelper 0.7.1","text":"Add check server hscdiip access package load. Add recid lookup use recid filtering parameter. using get_anon_chi() now use phsmethods::chi_check (available) warn lot CHI numbers return invalid. Update variable lists new Home Care related variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-070","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.0","title":"slfhelper 0.7.0","text":"Now depends R >= 3.5 ep_file_vars indiv_file_vars updated latest variable names. now also return character vector instead list. read_slf_ now returns tibble.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-060","dir":"Changelog","previous_headings":"","what":"slfhelper 0.6.0","title":"slfhelper 0.6.0","text":"Fix bug selecting partnerships/recids also selecting multiple years (#13) (#14)","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-053","dir":"Changelog","previous_headings":"","what":"slfhelper 0.5.3","title":"slfhelper 0.5.3","text":"Added NEWS.md file track changes package. Moved use Rmd version readme. Bump dplyr version requirement 1.0.0 enable use across() new things. Add checks year","code":""}]
+[{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to slfhelper","title":"Contributing to slfhelper","text":"outlines propose change slfhelper.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to slfhelper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to slfhelper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to slfhelper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"Public-Health-Scotland/slfhelper\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to slfhelper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to slfhelper","text":"Please note slfhelper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2019 James McMahon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with slfhelper","title":"Getting help with slfhelper","text":"Thanks using slfhelper! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with slfhelper","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with slfhelper","text":"Armed reprex, next step figure ask. ’s question: start SLF Teams channel. ’s bug: ’re right place, file issue. ’re sure: feel free either! opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"slfhelper","dir":"Articles","previous_headings":"","what":"SLFhelper","title":"slf-documentation","text":"SLFhelper contains easy use functions designed make working Source Linkage Files (SLFs) efficient possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"filter-functions","dir":"Articles","previous_headings":"SLFhelper","what":"Filter functions:","title":"slf-documentation","text":"year returns financial year interest. can also select multiple years using c(\"1718\", \"1819\", \"1920\") recid returns recids interest. Selecting beneficial specific analysis. partnerships returns partnerships interest. Selecting certain partnerships reduce SLFs size. col_select returns columns interest. best way reduce SLFs size.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"data-snippets","dir":"Articles","previous_headings":"SLFhelper","what":"Data snippets:","title":"slf-documentation","text":"ep_file_vars returns list variables episode files. indiv_file_vars returns list variables individual files. partnerships returns list partnership names (HSCP_2018 codes) recid returns list recids available SLFs. ep_file_bedday_vars returns list bedday related variables SLFs. ep_file_cost_vars returns list cost related variables SLFs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"anon-chi","dir":"Articles","previous_headings":"SLFhelper","what":"Anon CHI","title":"slf-documentation","text":"Use function get_chi() easily switch anon_chi chi. Use function get_anon_chi() easily switch chi anon_chi.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"memory-usage-in-slfs","dir":"Articles","previous_headings":"SLFhelper","what":"Memory usage in SLFS","title":"slf-documentation","text":"working Source Linkage Files (SLFs), recommended use features SLFhelper package maximase memory usage posit, see PHS Data Science Knowledge Base guidance memory usage posit workbench. Reading full SLF file can time consuming take resources posit workbench. episode file 251 variables around 12 million rows compared individual file 193 variables around 6 million rows file. can reduced using available selections SLFhelper help reduce size SLFs analysis free resources posit workbench. tables show memory usage full size SLF.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"individual-file","dir":"Articles","previous_headings":"SLFhelper > Memory usage in SLFS","what":"Individual File","title":"slf-documentation","text":"one can use selection features SLFhelper, session memory requirement can reduced. 251 columns year episode file size around 20 GiB. Hence, average, column rows takes around 0.1 GiB, can give rough estimate session memory one needs. Taking Year 1920 demonstration, following tables present various sizes extracts SLF files, 5 columns columns, along amount memory required work data one reads . Keep mind tables just recommendations, memory usage depends one handles data optimises data pipeline.","code":""},{"path":[]},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slfhelper-applications.html","id":"examples-using-slfhelper","dir":"Articles","previous_headings":"","what":"Examples using SLFhelper","title":"slfhelper-applications","text":"&E attendances East Lothian age group. Produce table compare &E Attendances following age groups (0-17, 18-64, 65-74, 75-84, 85+) 2018/19 East Lothian HSCP. Outpatient attendances specialty gender. Create table compare number outpatient attendances (SMR00) broken specialty gender 2017/18 Scotland. Hospital admissions & beddays HB residence. Produce table compare number admissions, bed days average length stay (split elective non-elective) Health Board Residence 2018/19. GP Hours Consulations South Ayrshire. Create table showing number GP Hours consultations patients dementia South Ayrshire HSCP 2019/20 broken type consultation. Costs Aberdeen City. Produce table show number patients total costs Aberdeen City HSCP 2018/19. Include breakdown costs following services: Acute (inpatients & daycases), GLS, Mental Health Maternity, Outpatients, &E, GP Hours, Community Prescribing. Deaths Dementia / Alzheimers Produce chart show number deaths 2015/16 2019/20 Scotland main cause death recorded Dementia/Alzheimers (ICD 10 codes: G30, F01-F03, F05.1). Number cost prescriptions MS Create table compare number cost prescribed items patients Multiple Sclerosis (MS) HSCP 2018/19. Include number dispensed items cost per patient. &E attendance last 3 months life. Produce table show number deaths Glasgow City HSCP 2019/20 proportion &E attendance last 3 months life. Non elective admissions Geriatric Medicine. Create table showing number non-elective admissions part stay (Continuous Inpatient Journey, CIJ) specialty Geriatric Medicine, HSCP 2019/20. Also include associated bed days, cost number patients.","code":"# read in data required from slf individual file - filter for year 2018/19 el_1819 <- read_slf_individual( year = \"1819\", # select variables needed col_select = c(\"age\", \"ae_attendances\"), # filter partnership for East Lothian partnerships = \"S37000010\" ) # create age bands age_labs <- c(\"0-17\", \"18-64\", \"65-74\", \"75-84\", \"85+\") # create age labels # create age group variable el_1819 <- el_1819 %>% mutate(age_group = cut(age, breaks = c(-1, 17, 64, 74, 84, 150), labels = age_labs )) # produce summary table output_table_1 <- el_1819 %>% group_by(age_group) %>% summarise(attendances = sum(ae_attendances)) %>% ungroup() # read in specialty lookup with names spec_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/National Reference Files/Specialty.csv\") %>% select( spec = Speccode, spec_name = Description ) # read in data required from slf episode file - filter year = 2017/18 op_1718 <- read_slf_episode( year = \"1718\", # select columns col_select = c(\"recid\", \"gender\", \"spec\"), # filter on recid for outpatients recids = \"00B\" ) # produce output output_table_2 <- op_1718 %>% # get counts by specialty and gender count(spec, gender) %>% # exclude those with no gender recorded filter(gender == 1 | gender == 2) %>% # recode gender into M/F mutate(gender = recode(as.character(gender), \"1\" = \"Male\", \"2\" = \"Female\")) %>% # move gender to separate columns pivot_wider(names_from = gender, values_from = n) %>% # match on specialty names left_join(spec_lookup) %>% # reorder variables select(spec, spec_name, Male, Female) # Read in names for Health Boards hb_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Health Board Area 2019 Lookup.csv\") %>% select( hb2019 = HealthBoardArea2019Code, hb_desc = HealthBoardArea2019Name ) # read in data required from slf individual file - filter for 2018/19 indiv_1819 <- read_slf_individual( year = \"1819\", # Select columns of interest col_select = c( \"hb2019\", \"cij_el\", \"cij_non_el\", \"acute_el_inpatient_beddays\", \"mh_el_inpatient_beddays\", \"gls_el_inpatient_beddays\", \"acute_non_el_inpatient_beddays\", \"mh_non_el_inpatient_beddays\", \"gls_non_el_inpatient_beddays\" ) ) # calculate total bed days and add on HB names indiv_1819_inc_totals <- indiv_1819 %>% # calculate overall bed days mutate( elective_beddays = acute_el_inpatient_beddays + mh_el_inpatient_beddays + gls_el_inpatient_beddays, non_elective_beddays = acute_non_el_inpatient_beddays + mh_non_el_inpatient_beddays + gls_non_el_inpatient_beddays ) %>% # match on HB name left_join(hb_lookup) # produce summary table output_table_3 <- indiv_1819_inc_totals %>% # group by HB of residence group_by(hb2019, hb_desc) %>% # produce summary table summarise( elective_adm = sum(cij_el), non_elective_adm = sum(cij_non_el), elective_beddays = sum(elective_beddays), non_elective_beddays = sum(non_elective_beddays) ) %>% # calculate average length of stay mutate( elective_alos = elective_beddays / elective_adm, non_elective_alos = non_elective_beddays / non_elective_adm ) # read in data required from slf episode file - filter for year = 2019/20 sa_1920 <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"dementia\", \"smrtype\"), # filter for South Ayrshire HSCP partnerships = \"S37000027\", # Filter for GP OOH data recids = \"OoH\" ) # select dementia patients sa_dementia_1920 <- sa_1920 %>% filter(dementia == 1) # produce summary table output_table_4 <- sa_dementia_1920 %>% count(smrtype) # read in data required from slf individual file - filter year = 2018/19 ab_1819 <- read_slf_individual( year = \"1819\", # select columns col_select = c( \"acute_cost\", \"gls_cost\", \"mh_cost\", \"mat_cost\", \"op_cost_attend\", \"ae_cost\", \"ooh_cost\", \"pis_cost\", \"health_net_cost\" ), # filter for Aberdeen City partnerships = \"S37000001\" ) # Have used variables which exclude the cost of outpatient attendances which did # not attend (DNA) but you could also include this if needed. # produce summary table output_table_5 <- ab_1819 %>% # rename outatients variable rename(op_cost = op_cost_attend) %>% # sum of all cost variables and number of patients summarise(across(ends_with(\"_cost\"), ~ sum(.x, na.rm = TRUE)), patients = n() ) %>% # switch to rows pivot_longer(everything()) # read in data required from slf episode file - filter for years 2015/16 to 2019/20 deaths <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\", \"1920\"), # select columns col_select = c(\"year\", \"deathdiag1\"), # Filter for death records recids = \"NRS\" ) # extract 3 & 4 digit codes and select those with dementia dementia_deaths <- deaths %>% # extract 3 & 4 digit ICD 10 codes mutate( diag_3d = str_sub(deathdiag1, 1, 3), diag_4d = str_sub(deathdiag1, 1, 4) ) %>% # select dementia codes filter(diag_3d == \"G30\" | diag_3d == \"F00\" | diag_3d == \"F01\" | diag_3d == \"F02\" | diag_3d == \"F03\" | diag_4d == \"F051\") # produce summary table output_table_6 <- dementia_deaths %>% count(year) %>% rename(deaths = n) # read in HSCP names (used in exercises 7 & 9) hscp_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Integration Authority 2019 Lookup.csv\") %>% select( hscp2019 = IntegrationAuthority2019Code, hscp_desc = IntegrationAuthority2019Name ) # read in data required from slf episode file - filter for year = 2018/19 pis_1819 <- read_slf_individual(\"1819\", col_select = c(\"hscp2019\", \"ms\", \"pis_paid_items\", \"pis_cost\") ) # select all patients with MS & add on HSCP name ms_1819 <- pis_1819 %>% filter(ms == 1) %>% left_join(hscp_lookup) # produce summary table output_table_7 <- ms_1819 %>% # group by hscp group_by(hscp2019, hscp_desc) %>% # sum up number of items, costs & patients with MS (not all will have had prescription) summarise( pis_paid_items = sum(pis_paid_items), pis_cost = sum(pis_cost), patients = sum(ms) ) %>% ungroup() %>% # calculate number of items / cost per patient mutate( items_per_patient = pis_paid_items / patients, cost_per_patient = pis_cost / patients ) # extract all deaths in Glasgow City in 1920 - Filter year = 1920 gc_deaths <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"anon_chi\", \"death_date\"), # filter for Glasgow City partnerships = \"S37000015\", # Filter for death records recids = \"NRS\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # exclude duplicates distinct(anon_chi, death_date) # extract all A&E attendances in 1819 & 1920 ae <- read_slf_episode( year = c(\"1819\", \"1920\"), # select columns col_select = c(\"anon_chi\", \"recid\", \"record_keydate1\"), # filter for A&E data recids = \"AE2\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # rename date of attendance rename(attendance_date = record_keydate1) # select A&E attendances for those individuals who are in the GC deaths file ae_gc <- ae %>% # filter A&E attendances for those in deaths file semi_join(gc_deaths) %>% # match on date of death left_join(gc_deaths) # select A&E attendances which are within 3 months of death (counted as 91 days) ae_gc_3m <- ae_gc %>% # create 3 month interval mutate(int_3m = interval(death_date - days(91), death_date)) %>% # flag if attendance is in 3 month interval mutate(att_3m = if_else(attendance_date %within% int_3m, 1, 0)) %>% # select only those attendances in 3 months before death filter(att_3m == 1) # create list of patients with A&E attendance in 3m period pats_ae_3m <- ae_gc_3m %>% # select only chi and attendance flag select(anon_chi, att_3m) %>% # restrict to one row per person distinct() # final output for total number of deaths and number with an A&E attendance in last 3 months output_table_8 <- gc_deaths %>% # match on attendance flag left_join(pats_ae_3m) %>% # summarise total deaths and deaths with A&E attendance in last 3 months summarise( deaths = n(), deaths_with_ae_att = sum(att_3m, na.rm = TRUE) ) %>% # calculate % mutate(prop_ae_3m = deaths_with_ae_att / deaths) # extract data required from episode file smr_1920 <- read_slf_episode( year = \"1920\", col_select = c( \"anon_chi\", \"record_keydate1\", \"record_keydate2\", \"spec\", \"hscp2019\", \"yearstay\", \"cost_total_net\", \"cij_marker\", \"cij_pattype\" ), recids = c(\"01B\", \"GLS\", \"04B\") ) %>% # exclude those with missing chi filter(anon_chi != \"\") # flag episodes in Geriatric Medicine specialty AB smr_1920 <- smr_1920 %>% mutate(ger_med = if_else(spec == \"AB\", 1, 0)) # select only those from non-elective stays smr_1920_ne <- smr_1920 %>% filter(cij_pattype == \"Non-Elective\") # aggregate to cij level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost cij_1920 <- smr_1920_ne %>% arrange(anon_chi, cij_marker, record_keydate1, record_keydate2) %>% group_by(anon_chi, cij_marker) %>% summarise( across(record_keydate1, min), across(c(record_keydate2, ger_med), max), across(c(cij_pattype, hscp2019), last), across(c(yearstay, cost_total_net), sum) ) %>% ungroup() # select only admissions with part of their stay in Geriatric Medicine specialty cij_ger_med <- cij_1920 %>% filter(ger_med == 1) # aggregate up to patient level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost pat_1920 <- cij_ger_med %>% group_by(anon_chi, hscp2019) %>% summarise( across(c(ger_med, yearstay, cost_total_net), sum) ) %>% ungroup() # produce output # note patients may be counted in more than one hscp output_table_9 <- pat_1920 %>% # match on hscp names left_join(hscp_lookup) %>% # group up to hscp level group_by(hscp2019, hscp_desc) %>% # sum up measures summarise( admissions = sum(ger_med), beddays = sum(yearstay), cost = sum(cost_total_net), patients = n() ) %>% ungroup()"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"using-parquet-files-with-the-arrow-package","dir":"Articles","previous_headings":"","what":"Using Parquet files with the arrow package","title":"Using Parquet files with the arrow package","text":"SLFs available parquet format. {arrow} package gives extra features can speed reduce memory usage even . can read specific columns read_parquet(file, col_select = c(var1, var2)). Using arrow’s ‘Arrow Table’ feature, can speed analysis efficiently. , specify as_data_frame = FALSE using SLFhelper dplyr::collect() read data.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"for-example","dir":"Articles","previous_headings":"Using Parquet files with the arrow package","what":"For example:","title":"Using Parquet files with the arrow package","text":"Imagine scenario analysing planned unplanned beddays Scotland, two ways read episode files analysis setting as_data_frame TRUE FALSE follows. specifying as_data_frame = FALSE using reading SLF functions, one enjoys great advantages parquet files. One advantages fast query processing reading necessary columns rather entire rows. table demonstrates huge impact advantages. Comparison different ways reading SLF files","code":"library(slfhelper) ## FAST METHOD # Filter for year of interest slf_extract1 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = FALSE ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay)) %>% # collect the arrow table dplyr::collect() ## SLOW and DEFAULT Method # Filter for year of interest slf_extract2 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = TRUE # which is default ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-only-specified-variables","dir":"Articles","previous_headings":"","what":"Selecting only specified variables","title":"Using variable packs","text":"recommended choose variables need reading Source Linkage File. can achieved specifying col_select argument relevant read_slf_ function. result data read much faster well easy work . full episode individual files 200+ 100+ variables respectively!","code":"library(slfhelper) ep_data <- read_slf_episode(year = 1920, col_select = c(\"year\", \"anon_chi\", \"recid\")) indiv_data <- read_slf_individual(year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-variables-using-tidyselect-functions","dir":"Articles","previous_headings":"","what":"Selecting variables using tidyselect functions","title":"Using variable packs","text":"now allowed use tidyselect functions, contains() start_with(), select variables relevant read_slf_ function. One can also mix tidyselect functions specified variables selecting.","code":"library(slfhelper) ep_data <- read_slf_episode( year = 1920, col_select = !tidyselect::contains(\"keytime\") ) indiv_data <- read_slf_individual( year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\", tidyselect::starts_with(\"sds\")) )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"looking-up-variable-names","dir":"Articles","previous_headings":"","what":"Looking up variable names","title":"Using variable packs","text":"help task picking variables might need analysis, well getting spelling correct, provide lists variable names package.","code":"# Show the first few variables from the episode file head(ep_file_vars) #> [1] \"year\" \"recid\" \"record_keydate1\" \"record_keydate2\" #> [5] \"smrtype\" \"anon_chi\" # Do the same for the individual file head(indiv_file_vars) #> [1] \"anon_chi\" \"gender\" \"postcode\" #> [4] \"dob\" \"gpprac\" \"sc_latest_submission\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"variable-packs","dir":"Articles","previous_headings":"","what":"Variable packs","title":"Using variable packs","text":"great can still lot effort copy/pasting every time, especially need quite variables analysis. assist , number ‘variable packs’, groups variables commonly needed together can accessed simple name. Currently four packs; demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Let’s see contain.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"demographic-variables","dir":"Articles","previous_headings":"Variable packs","what":"Demographic variables","title":"Using variable packs","text":"demographic variables specific CHI can used episode individual file.","code":"demog_vars #> [1] \"anon_chi\" \"gender\" #> [3] \"dob\" \"age\" #> [5] \"gpprac\" \"hbpraccode\" #> [7] \"postcode\" \"hbrescode\" #> [9] \"hscp2018\" \"lca\" #> [11] \"ca2018\" \"locality\" #> [13] \"datazone2011\" \"hb2019\" #> [15] \"hscp2019\" \"ca2019\" #> [17] \"simd2020v2_rank\" \"simd2020v2_sc_decile\" #> [19] \"simd2020v2_sc_quintile\" \"simd2020v2_hb2019_decile\" #> [21] \"simd2020v2_hb2019_quintile\" \"simd2020v2_hscp2019_decile\" #> [23] \"simd2020v2_hscp2019_quintile\" \"ur8_2016\" #> [25] \"ur6_2016\" \"ur3_2016\" #> [27] \"ur2_2016\" \"cluster\" #> [29] \"demographic_cohort\" \"service_use_cohort\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"long-term-condition-ltc-variables","dir":"Articles","previous_headings":"Variable packs","what":"Long Term Condition (LTC) variables","title":"Using variable packs","text":"Long Term Condition flag variables specific CHI can used episode individual file.","code":"ltc_vars #> [1] \"arth\" \"asthma\" \"atrialfib\" \"cancer\" \"cvd\" #> [6] \"liver\" \"copd\" \"dementia\" \"diabetes\" \"epilepsy\" #> [11] \"chd\" \"hefailure\" \"ms\" \"parkinsons\" \"refailure\" #> [16] \"congen\" \"bloodbfo\" \"endomet\" \"digestive\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"bedday-variables","dir":"Articles","previous_headings":"Variable packs","what":"Bedday variables","title":"Using variable packs","text":"variables detailing beddays, specific episode can used episode file.","code":"ep_file_bedday_vars #> [1] \"yearstay\" \"stay\" \"apr_beddays\" \"may_beddays\" \"jun_beddays\" #> [6] \"jul_beddays\" \"aug_beddays\" \"sep_beddays\" \"oct_beddays\" \"nov_beddays\" #> [11] \"dec_beddays\" \"jan_beddays\" \"feb_beddays\" \"mar_beddays\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"cost-variables","dir":"Articles","previous_headings":"Variable packs","what":"Cost variables","title":"Using variable packs","text":"variables detailing costs, specific episode can used episode file.","code":"ep_file_cost_vars #> [1] \"cost_total_net\" \"cost_total_net_inc_dnas\" #> [3] \"apr_cost\" \"may_cost\" #> [5] \"jun_cost\" \"jul_cost\" #> [7] \"aug_cost\" \"sep_cost\" #> [9] \"oct_cost\" \"nov_cost\" #> [11] \"dec_cost\" \"jan_cost\" #> [13] \"feb_cost\" \"mar_cost\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"using-variable-packs","dir":"Articles","previous_headings":"","what":"Using variable packs","title":"Using variable packs","text":"variable packs can used column selection simplify code substantially. example take demographic data LTC flags individual file. get bedday information Acute records episode file.","code":"library(slfhelper) indiv_ltc_data <- read_slf_individual(year = 1920, col_select = c(\"year\", demog_vars, ltc_vars)) library(slfhelper) acute_beddays <- read_slf_episode( year = 1920, col_select = c(\"year\", \"anon_chi\", \"hbtreatcode\", \"recid\", ep_file_bedday_vars, \"cij_pattype\"), recid = c(\"01B\", \"GLS\") )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Using variable packs","text":"using column argument reading data increase read speed, reduce amount data loading R. slfhelper provides number helpers make picking using variables need easier. like changes made existing packs, please open issue GitHub. like suggest additional variable packs, either open issue, even submit pull request!","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Public Health Scotland. Copyright holder. James McMahon. Author. Megan McNicol. Maintainer, author. Zihao Li. Author. Jennifer Thom. Author.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"McMahon J, McNicol M, Li Z, Thom J (2024). slfhelper: Useful functions working Source Linkage Files. R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper, https://public-health-scotland.github.io/slfhelper/.","code":"@Manual{, title = {slfhelper: Useful functions for working with the Source Linkage Files}, author = {James McMahon and Megan McNicol and Zihao Li and Jennifer Thom}, year = {2024}, note = {R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper}, url = {https://public-health-scotland.github.io/slfhelper/}, }"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper","dir":"","previous_headings":"","what":"Useful functions for working with the Source Linkage Files","title":"Useful functions for working with the Source Linkage Files","text":"goal slfhelper provide easy--use functions make working Source Linkage Files painless efficient possible. intended use PHS employees work PHS R infrastructure.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Useful functions for working with the Source Linkage Files","text":"simplest way install PHS Posit Workbench environment use PHS Package Manager, default setting means can install slfhelper package. doesn’t work can install directly GitHub, number ways , recommend {pak} package.","code":"install.packages(\"slfhelper\") # Install pak (if needed) install.packages(\"pak\") # Use pak to install slfhelper pak::pak(\"Public-Health-Scotland/slfhelper\")"},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper-articles","dir":"","previous_headings":"Additional Documentation","what":"SLFhelper Articles","title":"Useful functions for working with the Source Linkage Files","text":"created additional documentation help using SLFhelper. new documentation can found : https://public-health-scotland.github.io/slfhelper/ selecting drop Articles. includes: * Memory usage using SLFs Posit * Using arrow package SLFs * Example questions answered using SLFs (full code available) find useful like see topics included future documentation, please get touch team.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"read-a-file","dir":"","previous_headings":"Usage","what":"Read a file","title":"Useful functions for working with the Source Linkage Files","text":"Note: Reading full file quite slow use lot memory, always recommend column selection keep variables need analysis. Just dramatically speed read time. provide data snippets help column selection filtering. options reading files can () combined required.","code":"library(slfhelper) # Get a list of the variables in a file ep_file_vars indiv_file_vars # See a lookup of Partnership names to HSCP_2018 codes View(partnerships) # See a list with descriptions for the recids View(recids) # See a list of Long term conditions View(ltc_vars) # See a list of bedday related variables View(ep_file_bedday_vars) # See a list of cost related variables View(ep_file_cost_vars) library(slfhelper) # Read a group of variables e.g. LTCs (arth, asthma, atrialfib etc) # A nice 'catch all' for reading in all of the LTC variables ep_1718 <- read_slf_episode(\"1718\", col_select = c(\"anon_chi\", ltc_vars)) # Read in a group of variables e.g. bedday related variables (yearstay, stay, apr_beddays etc) # A 'catch all' for reading in bedday related variables ep_1819 <- read_slf_episode(\"1819\", col_select = c(\"anon_chi\", ep_file_bedday_vars)) # Read in a group of variables e.g. cost related variables (cost_total_net, apr_cost) # A 'catch all' for reading in cos related variables ep_1920 <- read_slf_episode(\"1920\", col_select = c(\"anon_chi\", ep_file_cost_vars)) library(slfhelper) # Read certain variables # It's much faster to choose variables like this indiv_1718 <- read_slf_individual(year = \"1718\", col_select = c(\"anon_chi\", \"hri_scot\")) # Read multiple years # This will use dplyr::bind_rows() and return the files added together as a single tibble episode_data <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\"), col_select = c(\"anon_chi\", \"yearstay\") ) # Read only data for a certain partnership (HSCP_2018 code) # This can be a single partnership or multiple by supplying a vector e.g. c(...) indiv_1718 <- read_slf_individual( year = \"1718\", partnerships = \"S37000001\", # Aberdeen City col_select = c(\"anon_chi\", \"hri_scot\") ) # Read only data for a certain recid # This can be a single recid or multiple by supplying a vector e.g. c(...) ep_1718 <- read_slf_episode(\"1718\", recid = c(\"01B\", \"GLS\"), col_select = c(\"anon_chi\", \"yearstay\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"match-on-chi-numbers-to-anon_chi-or-vice-versa","dir":"","previous_headings":"Usage","what":"Match on CHI numbers to Anon_CHI (or vice versa)","title":"Useful functions for working with the Source Linkage Files","text":"","code":"library(slfhelper) # Add real CHI numbers to a SLF ep_1718 <- read_slf_episode(c(\"1718\", \"1819\", \"1920\"), col_select = c(\"year\", \"anon_chi\", \"demographic_cohort\") ) %>% get_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 the cohort sample chi_cohort <- chi_cohort %>% get_anon_chi(chi_var = \"upi_number\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the current user is in a UNIX group — check_has_access","title":"Check if the current user is in a UNIX group — check_has_access","text":"Check current user UNIX group","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the current user is in a UNIX group — check_has_access","text":"","code":"check_has_access(group = \"hscdiip\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the current user is in a UNIX group — check_has_access","text":"group group check, default hscdiip","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the current user is in a UNIX group — check_has_access","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if it's a server session — check_on_server","title":"Check if it's a server session — check_on_server","text":"Check server session","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if it's a server session — check_on_server","text":"","code":"check_on_server()"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if it's a server session — check_on_server","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Check the year(s) supplied are valid — check_year","title":"Check the year(s) supplied are valid — check_year","text":"Check year(s) supplied valid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check the year(s) supplied are valid — check_year","text":"","code":"check_year(year, call = rlang::caller_env())"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check the year(s) supplied are valid — check_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). call Supply environment top-level function make error messages useful.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check the year(s) supplied are valid — check_year","text":"TRUE year valid newer year, FALSE older still valid years. Otherwise throws error.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":null,"dir":"Reference","previous_headings":"","what":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"tibble containing example cohort CHI numbers different variable names. used testing illustrate examples. likely many 'chi numbers' valid.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"","code":"chi_cohort"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"object class tbl_df (inherits tbl, data.frame) 100 rows 2 columns.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Demographic variables — demog_vars","title":"Demographic variables — demog_vars","text":"vector containing names demographic variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Demographic variables — demog_vars","text":"","code":"demog_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Demographic variables — demog_vars","text":"object class character length 30.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file bedday variables — ep_file_bedday_vars","title":"Episode file bedday variables — ep_file_bedday_vars","text":"vector containing names bedday related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file bedday variables — ep_file_bedday_vars","text":"","code":"ep_file_bedday_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file bedday variables — ep_file_bedday_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file cost variables — ep_file_cost_vars","title":"Episode file cost variables — ep_file_cost_vars","text":"vector containing names cost related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file cost variables — ep_file_cost_vars","text":"","code":"ep_file_cost_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file cost variables — ep_file_cost_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file variables — ep_file_vars","title":"Episode file variables — ep_file_vars","text":"names variables episode files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file variables — ep_file_vars","text":"","code":"ep_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file variables — ep_file_vars","text":"object class character length 251.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a year into the correct short FY format — format_year","title":"Format a year into the correct short FY format — format_year","text":"Format year correct short FY format","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a year into the correct short FY format — format_year","text":"","code":"format_year(year)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a year into the correct short FY format — format_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year().","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format a year into the correct short FY format — format_year","text":"Year correctly formatted short FY e.g. '1718'","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Source Linkage File, file path — gen_file_path","title":"Generate a Source Linkage File, file path — gen_file_path","text":"Generate Source Linkage File, file path","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a Source Linkage File, file path — gen_file_path","text":"","code":"gen_file_path(year, file_version, call, dev = FALSE, ext = \"parquet\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a Source Linkage File, file path — gen_file_path","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). call Supply environment top-level function make error messages useful. dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. ext file extension read.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Source Linkage File, file path — gen_file_path","text":"fs_path object.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"Match anon_chi dataset using CHI numbers","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"get_anon_chi(chi_cohort, chi_var = \"chi\", drop = TRUE, check = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"chi_cohort tibble data frame. chi_var CHI variable: name variable containing CHI (default chi). drop Optional boolean indicating whether existing chi_var dropped - default TRUE. check Optional boolean, CHIs checked using phsmethods::chi_check() - default TRUE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"if (FALSE) { # \\dontrun{ chi_cohort %>% get_anon_chi() chi_cohort %>% get_anon_chi(chi_var = \"upi_number\") } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on CHI numbers to a dataset using anon_chi — get_chi","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"Match CHI numbers dataset using anon_chi","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"get_chi(data, anon_chi_var = \"anon_chi\", drop = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"data tibble data frame anon_chi_var Anon CHI variable: name variable containing anonymised CHI (default anon_chi) drop Optional boolean indicating whether existing anon_chi_var dropped - default TRUE","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"if (FALSE) { # \\dontrun{ slf_1718 <- read_slf_individual(\"1718\") get_chi(slf_1718) get_chi(slf_1718, drop = FALSE) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual file variables — indiv_file_vars","title":"Individual file variables — indiv_file_vars","text":"names variables individual files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual file variables — indiv_file_vars","text":"","code":"indiv_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Individual file variables — indiv_file_vars","text":"object class character length 193.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"LTC variables — ltc_vars","title":"LTC variables — ltc_vars","text":"vector containing names Long Term Condition (LTC) variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"LTC variables — ltc_vars","text":"","code":"ltc_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"LTC variables — ltc_vars","text":"object class character length 19.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":null,"dir":"Reference","previous_headings":"","what":"HSCP name / code lookup — partnerships","title":"HSCP name / code lookup — partnerships","text":"tibble containing names codes (hscp2018 configuration) partnerships. used partnership parameter reading files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"HSCP name / code lookup — partnerships","text":"","code":"partnerships"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"HSCP name / code lookup — partnerships","text":"tibble 31 rows 2 variables: partnership_name official name Partnership hscp2018 hscp2018 standard code S370000??","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage File — read_slf","title":"Read a Source Linkage File — read_slf","text":"Read Source Linkage File","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage File — read_slf","text":"","code":"read_slf( year, file_version = c(\"episode\", \"individual\"), dev = FALSE, col_select = NULL, columns = lifecycle::deprecated(), as_data_frame = TRUE, partnerships = NULL, recids = NULL )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage File — read_slf","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). columns columns longer used, use col_select instead. as_data_frame function return tibble (default) Arrow Table? partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage File — read_slf","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage episode file — read_slf_episode","title":"Read a Source Linkage episode file — read_slf_episode","text":"Read Source Linkage episode file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"read_slf_episode( year, col_select = NULL, partnerships = NULL, recids = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage episode file — read_slf_episode","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage episode file — read_slf_episode","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_episode(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\") ) read_slf_episode(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage individual file — read_slf_individual","title":"Read a Source Linkage individual file — read_slf_individual","text":"Read Source Linkage individual file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"read_slf_individual( year, col_select = NULL, partnerships = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage individual file — read_slf_individual","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage individual file — read_slf_individual","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_individual(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"hri_scot\") ) read_slf_individual(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"hri_scot\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":null,"dir":"Reference","previous_headings":"","what":"Recid name / description lookup — recids","title":"Recid name / description lookup — recids","text":"tibble containing names description recids. used recid parameter reading episode files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recid name / description lookup — recids","text":"","code":"recids"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Recid name / description lookup — recids","text":"tibble 18 rows 2 variables: recid short-form recid Description description recid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":null,"dir":"Reference","previous_headings":"","what":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"package provides helper functions working Source Linkage Files (SLFs). functions mainly focused making first steps analysis easier. can read filter files efficiently using minimal code.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"Maintainer: Megan McNicol megan.mcnicol2@phs.scot Authors: James McMahon james.mcmahon@phs.scot (ORCID) Zihao Li zihao.li@phs.scot (ORCID) Jennifer Thom jennifer.thom@phs.scot contributors: Public Health Scotland phs.source@phs.scot [copyright holder]","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0104","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.4","title":"slfhelper 0.10.4","text":"Bug - Fix build tests New feature - Additional documentation Update README.md Bug - Fix tidyselect feature bug","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0103","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.3","title":"slfhelper 0.10.3","text":"New feature - use tidyselect col_selectin read_slf_episode read_slf_individual.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0102","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.2","title":"slfhelper 0.10.2","text":"Update README.md change episode file cost variable vector force keytime format hms","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0101","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.1","title":"slfhelper 0.10.1","text":"Update README.Rmd Bug - speed get_chi()","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0100","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.0","title":"slfhelper 0.10.0","text":"{glue} longer dependency required functionality can provided `stringr::str_glue(). Dependency versions updated latest. get_chi() get_anon_chi() now properly match missing (NA) blank (\"\") values. slfhelper now defaults using .parquet file versions, old versions slfhelper longer work. now dev parameter available using read_slf_* functions allows reading file development environment.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-090","dir":"Changelog","previous_headings":"","what":"slfhelper 0.9.0","title":"slfhelper 0.9.0","text":"{openssl} now required. get_chi() get_anon_chi() now much faster (>100X) use significantly less memory. year parameter now checked early process, invalid year supplied error message much informative.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-082","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.2","title":"slfhelper 0.8.2","text":"ep_file_vars indiv_file_vars updated correct variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-081","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.1","title":"slfhelper 0.8.1","text":"Use cli nicer error messages warning.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-080","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.0","title":"slfhelper 0.8.0","text":"Add number ‘variable packs’ easily selecting sets variables: demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Add new vignette introducing variable packs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-071","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.1","title":"slfhelper 0.7.1","text":"Add check server hscdiip access package load. Add recid lookup use recid filtering parameter. using get_anon_chi() now use phsmethods::chi_check (available) warn lot CHI numbers return invalid. Update variable lists new Home Care related variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-070","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.0","title":"slfhelper 0.7.0","text":"Now depends R >= 3.5 ep_file_vars indiv_file_vars updated latest variable names. now also return character vector instead list. read_slf_ now returns tibble.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-060","dir":"Changelog","previous_headings":"","what":"slfhelper 0.6.0","title":"slfhelper 0.6.0","text":"Fix bug selecting partnerships/recids also selecting multiple years (#13) (#14)","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-053","dir":"Changelog","previous_headings":"","what":"slfhelper 0.5.3","title":"slfhelper 0.5.3","text":"Added NEWS.md file track changes package. Moved use Rmd version readme. Bump dplyr version requirement 1.0.0 enable use across() new things. Add checks year","code":""}]
# Show the first few variables from the episode file
head(ep_file_vars)
-#> [1] "year" "recid" "anon_chi"
-#> [4] "postcode" "dd_responsible_lca" "record_keydate1"
+#> [1] "year" "recid" "record_keydate1" "record_keydate2"
+#> [5] "smrtype" "anon_chi"
# Do the same for the individual file
head(indiv_file_vars)
diff --git a/authors.html b/authors.html
index ac3498f..dba3c5a 100644
--- a/authors.html
+++ b/authors.html
@@ -65,7 +65,7 @@ Authors
Citation
- Source: DESCRIPTION
+ Source: DESCRIPTION
McMahon J, McNicol M, Li Z, Thom J (2024).
slfhelper: Useful functions for working with the Source Linkage Files.
diff --git a/news/index.html b/news/index.html
index 01b47dd..49d3309 100644
--- a/news/index.html
+++ b/news/index.html
@@ -36,7 +36,7 @@
diff --git a/pkgdown.yml b/pkgdown.yml
index 39f9487..1855862 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -6,7 +6,7 @@ articles:
slfhelper-applications: slfhelper-applications.html
using-arrow-table: using-arrow-table.html
variable-packs: variable-packs.html
-last_built: 2024-09-13T09:22Z
+last_built: 2024-09-13T15:14Z
urls:
reference: https://public-health-scotland.github.io/slfhelper/reference
article: https://public-health-scotland.github.io/slfhelper/articles
diff --git a/reference/check_has_access.html b/reference/check_has_access.html
index 9978256..b179e56 100644
--- a/reference/check_has_access.html
+++ b/reference/check_has_access.html
@@ -36,7 +36,7 @@
Check if the current user is in a UNIX group
- Source: R/zzz.R
+ Source: R/zzz.R
check_has_access.Rd
diff --git a/reference/check_on_server.html b/reference/check_on_server.html
index f715c2a..463aa8d 100644
--- a/reference/check_on_server.html
+++ b/reference/check_on_server.html
@@ -36,7 +36,7 @@
diff --git a/reference/check_year.html b/reference/check_year.html
index c15726b..7d1bb60 100644
--- a/reference/check_year.html
+++ b/reference/check_year.html
@@ -36,7 +36,7 @@
Check the year(s) supplied are valid
- Source: R/check_year.R
+ Source: R/check_year.R
check_year.Rd
diff --git a/reference/chi_cohort.html b/reference/chi_cohort.html
index 06bf8f2..df297ec 100644
--- a/reference/chi_cohort.html
+++ b/reference/chi_cohort.html
@@ -42,7 +42,7 @@
A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid.
- Source: R/data.R
+ Source: R/data.R
chi_cohort.Rd
diff --git a/reference/demog_vars.html b/reference/demog_vars.html
index 30088ca..bea5998 100644
--- a/reference/demog_vars.html
+++ b/reference/demog_vars.html
@@ -36,7 +36,7 @@
diff --git a/reference/ep_file_bedday_vars.html b/reference/ep_file_bedday_vars.html
index d589d05..af6907a 100644
--- a/reference/ep_file_bedday_vars.html
+++ b/reference/ep_file_bedday_vars.html
@@ -40,7 +40,7 @@
diff --git a/reference/ep_file_cost_vars.html b/reference/ep_file_cost_vars.html
index f065d98..a19a833 100644
--- a/reference/ep_file_cost_vars.html
+++ b/reference/ep_file_cost_vars.html
@@ -40,7 +40,7 @@
diff --git a/reference/ep_file_vars.html b/reference/ep_file_vars.html
index 44030a6..8cc7bcb 100644
--- a/reference/ep_file_vars.html
+++ b/reference/ep_file_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/format_year.html b/reference/format_year.html
index 300fbfb..3a2404b 100644
--- a/reference/format_year.html
+++ b/reference/format_year.html
@@ -36,7 +36,7 @@
Format a year into the correct short FY format
- Source: R/format_year.R
+ Source: R/format_year.R
format_year.Rd
diff --git a/reference/gen_file_path.html b/reference/gen_file_path.html
index 2dc6c09..f3461c3 100644
--- a/reference/gen_file_path.html
+++ b/reference/gen_file_path.html
@@ -36,7 +36,7 @@
Generate a Source Linkage File, file path
- Source: R/gen_file_path.R
+ Source: R/gen_file_path.R
gen_file_path.Rd
diff --git a/reference/get_anon_chi.html b/reference/get_anon_chi.html
index 91b0788..da48cd6 100644
--- a/reference/get_anon_chi.html
+++ b/reference/get_anon_chi.html
@@ -36,7 +36,7 @@
Match on anon_chi to a dataset using CHI numbers
- Source: R/get_anon_chi.R
+ Source: R/get_anon_chi.R
get_anon_chi.Rd
diff --git a/reference/get_chi.html b/reference/get_chi.html
index 8f1c2dc..b75c3dc 100644
--- a/reference/get_chi.html
+++ b/reference/get_chi.html
@@ -36,7 +36,7 @@
Match on CHI numbers to a dataset using anon_chi
- Source: R/get_chi.R
+ Source: R/get_chi.R
get_chi.Rd
diff --git a/reference/indiv_file_vars.html b/reference/indiv_file_vars.html
index 1dc7a3b..d698d66 100644
--- a/reference/indiv_file_vars.html
+++ b/reference/indiv_file_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/ltc_vars.html b/reference/ltc_vars.html
index 6489636..3f57a7a 100644
--- a/reference/ltc_vars.html
+++ b/reference/ltc_vars.html
@@ -38,7 +38,7 @@
diff --git a/reference/partnerships.html b/reference/partnerships.html
index 2edf45d..b765986 100644
--- a/reference/partnerships.html
+++ b/reference/partnerships.html
@@ -40,7 +40,7 @@
diff --git a/reference/pipe.html b/reference/pipe.html
index 284e25b..7dfba9e 100644
--- a/reference/pipe.html
+++ b/reference/pipe.html
@@ -36,7 +36,7 @@
diff --git a/reference/read_slf.html b/reference/read_slf.html
index 8086de7..aa4168d 100644
--- a/reference/read_slf.html
+++ b/reference/read_slf.html
@@ -36,7 +36,7 @@
diff --git a/reference/read_slf_episode.html b/reference/read_slf_episode.html
index 5e508e6..cfad0ba 100644
--- a/reference/read_slf_episode.html
+++ b/reference/read_slf_episode.html
@@ -36,7 +36,7 @@
Read a Source Linkage episode file
- Source: R/read_slf.R
+ Source: R/read_slf.R
read_slf_episode.Rd
diff --git a/reference/read_slf_individual.html b/reference/read_slf_individual.html
index a691635..8f9c069 100644
--- a/reference/read_slf_individual.html
+++ b/reference/read_slf_individual.html
@@ -36,7 +36,7 @@
Read a Source Linkage individual file
- Source: R/read_slf.R
+ Source: R/read_slf.R
read_slf_individual.Rd
diff --git a/reference/recids.html b/reference/recids.html
index c89238f..44841a8 100644
--- a/reference/recids.html
+++ b/reference/recids.html
@@ -40,7 +40,7 @@
diff --git a/reference/slfhelper-package.html b/reference/slfhelper-package.html
index 067d7c8..75ce3e6 100644
--- a/reference/slfhelper-package.html
+++ b/reference/slfhelper-package.html
@@ -36,7 +36,7 @@
slfhelper: Useful functions for working with the Source Linkage Files
- Source: R/slfhelper-package.R
+ Source: R/slfhelper-package.R
slfhelper-package.Rd
diff --git a/search.json b/search.json
index d544407..e084a35 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to slfhelper","title":"Contributing to slfhelper","text":"outlines propose change slfhelper.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to slfhelper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to slfhelper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to slfhelper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"Public-Health-Scotland/slfhelper\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to slfhelper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to slfhelper","text":"Please note slfhelper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2019 James McMahon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with slfhelper","title":"Getting help with slfhelper","text":"Thanks using slfhelper! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with slfhelper","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with slfhelper","text":"Armed reprex, next step figure ask. ’s question: start SLF Teams channel. ’s bug: ’re right place, file issue. ’re sure: feel free either! opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"slfhelper","dir":"Articles","previous_headings":"","what":"SLFhelper","title":"slf-documentation","text":"SLFhelper contains easy use functions designed make working Source Linkage Files (SLFs) efficient possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"filter-functions","dir":"Articles","previous_headings":"SLFhelper","what":"Filter functions:","title":"slf-documentation","text":"year returns financial year interest. can also select multiple years using c(\"1718\", \"1819\", \"1920\") recid returns recids interest. Selecting beneficial specific analysis. partnerships returns partnerships interest. Selecting certain partnerships reduce SLFs size. col_select returns columns interest. best way reduce SLFs size.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"data-snippets","dir":"Articles","previous_headings":"SLFhelper","what":"Data snippets:","title":"slf-documentation","text":"ep_file_vars returns list variables episode files. indiv_file_vars returns list variables individual files. partnerships returns list partnership names (HSCP_2018 codes) recid returns list recids available SLFs. ep_file_bedday_vars returns list bedday related variables SLFs. ep_file_cost_vars returns list cost related variables SLFs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"anon-chi","dir":"Articles","previous_headings":"SLFhelper","what":"Anon CHI","title":"slf-documentation","text":"Use function get_chi() easily switch anon_chi chi. Use function get_anon_chi() easily switch chi anon_chi.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"memory-usage-in-slfs","dir":"Articles","previous_headings":"SLFhelper","what":"Memory usage in SLFS","title":"slf-documentation","text":"working Source Linkage Files (SLFs), recommended use features SLFhelper package maximase memory usage posit, see PHS Data Science Knowledge Base guidance memory usage posit workbench. Reading full SLF file can time consuming take resources posit workbench. episode file 263 variables around 12 million rows compared individual file 205 variables around 6 million rows file. can reduced using available selections SLFhelper help reduce size SLFs analysis free resources posit workbench. tables show memory usage full size SLF.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"individual-file","dir":"Articles","previous_headings":"SLFhelper > Memory usage in SLFS","what":"Individual File","title":"slf-documentation","text":"one can use selection features SLFhelper, session memory requirement can reduced. 263 columns year episode file size around 20 GiB. Hence, average, column rows takes around 0.1 GiB, can give rough estimate session memory one needs. Taking Year 1920 demonstration, following tables present various sizes extracts SLF files, 5 columns columns, along amount memory required work data one reads . Keep mind tables just recommendations, memory usage depends one handles data optimises data pipeline.","code":""},{"path":[]},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slfhelper-applications.html","id":"examples-using-slfhelper","dir":"Articles","previous_headings":"","what":"Examples using SLFhelper","title":"slfhelper-applications","text":"&E attendances East Lothian age group. Produce table compare &E Attendances following age groups (0-17, 18-64, 65-74, 75-84, 85+) 2018/19 East Lothian HSCP. Outpatient attendances specialty gender. Create table compare number outpatient attendances (SMR00) broken specialty gender 2017/18 Scotland. Hospital admissions & beddays HB residence. Produce table compare number admissions, bed days average length stay (split elective non-elective) Health Board Residence 2018/19. GP Hours Consulations South Ayrshire. Create table showing number GP Hours consultations patients dementia South Ayrshire HSCP 2019/20 broken type consultation. Costs Aberdeen City. Produce table show number patients total costs Aberdeen City HSCP 2018/19. Include breakdown costs following services: Acute (inpatients & daycases), GLS, Mental Health Maternity, Outpatients, &E, GP Hours, Community Prescribing. Deaths Dementia / Alzheimers Produce chart show number deaths 2015/16 2019/20 Scotland main cause death recorded Dementia/Alzheimers (ICD 10 codes: G30, F01-F03, F05.1). Number cost prescriptions MS Create table compare number cost prescribed items patients Multiple Sclerosis (MS) HSCP 2018/19. Include number dispensed items cost per patient. &E attendance last 3 months life. Produce table show number deaths Glasgow City HSCP 2019/20 proportion &E attendance last 3 months life. Non elective admissions Geriatric Medicine. Create table showing number non-elective admissions part stay (Continuous Inpatient Journey, CIJ) specialty Geriatric Medicine, HSCP 2019/20. Also include associated bed days, cost number patients.","code":"# read in data required from slf individual file - filter for year 2018/19 el_1819 <- read_slf_individual( year = \"1819\", # select variables needed col_select = c(\"age\", \"ae_attendances\"), # filter partnership for East Lothian partnerships = \"S37000010\" ) # create age bands age_labs <- c(\"0-17\", \"18-64\", \"65-74\", \"75-84\", \"85+\") # create age labels # create age group variable el_1819 <- el_1819 %>% mutate(age_group = cut(age, breaks = c(-1, 17, 64, 74, 84, 150), labels = age_labs )) # produce summary table output_table_1 <- el_1819 %>% group_by(age_group) %>% summarise(attendances = sum(ae_attendances)) %>% ungroup() # read in specialty lookup with names spec_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/National Reference Files/Specialty.csv\") %>% select( spec = Speccode, spec_name = Description ) # read in data required from slf episode file - filter year = 2017/18 op_1718 <- read_slf_episode( year = \"1718\", # select columns col_select = c(\"recid\", \"gender\", \"spec\"), # filter on recid for outpatients recids = \"00B\" ) # produce output output_table_2 <- op_1718 %>% # get counts by specialty and gender count(spec, gender) %>% # exclude those with no gender recorded filter(gender == 1 | gender == 2) %>% # recode gender into M/F mutate(gender = recode(as.character(gender), \"1\" = \"Male\", \"2\" = \"Female\")) %>% # move gender to separate columns pivot_wider(names_from = gender, values_from = n) %>% # match on specialty names left_join(spec_lookup) %>% # reorder variables select(spec, spec_name, Male, Female) # Read in names for Health Boards hb_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Health Board Area 2019 Lookup.csv\") %>% select( hb2019 = HealthBoardArea2019Code, hb_desc = HealthBoardArea2019Name ) # read in data required from slf individual file - filter for 2018/19 indiv_1819 <- read_slf_individual( year = \"1819\", # Select columns of interest col_select = c( \"hb2019\", \"cij_el\", \"cij_non_el\", \"acute_el_inpatient_beddays\", \"mh_el_inpatient_beddays\", \"gls_el_inpatient_beddays\", \"acute_non_el_inpatient_beddays\", \"mh_non_el_inpatient_beddays\", \"gls_non_el_inpatient_beddays\" ) ) # calculate total bed days and add on HB names indiv_1819_inc_totals <- indiv_1819 %>% # calculate overall bed days mutate( elective_beddays = acute_el_inpatient_beddays + mh_el_inpatient_beddays + gls_el_inpatient_beddays, non_elective_beddays = acute_non_el_inpatient_beddays + mh_non_el_inpatient_beddays + gls_non_el_inpatient_beddays ) %>% # match on HB name left_join(hb_lookup) # produce summary table output_table_3 <- indiv_1819_inc_totals %>% # group by HB of residence group_by(hb2019, hb_desc) %>% # produce summary table summarise( elective_adm = sum(cij_el), non_elective_adm = sum(cij_non_el), elective_beddays = sum(elective_beddays), non_elective_beddays = sum(non_elective_beddays) ) %>% # calculate average length of stay mutate( elective_alos = elective_beddays / elective_adm, non_elective_alos = non_elective_beddays / non_elective_adm ) # read in data required from slf episode file - filter for year = 2019/20 sa_1920 <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"dementia\", \"smrtype\"), # filter for South Ayrshire HSCP partnerships = \"S37000027\", # Filter for GP OOH data recids = \"OoH\" ) # select dementia patients sa_dementia_1920 <- sa_1920 %>% filter(dementia == 1) # produce summary table output_table_4 <- sa_dementia_1920 %>% count(smrtype) # read in data required from slf individual file - filter year = 2018/19 ab_1819 <- read_slf_individual( year = \"1819\", # select columns col_select = c( \"acute_cost\", \"gls_cost\", \"mh_cost\", \"mat_cost\", \"op_cost_attend\", \"ae_cost\", \"ooh_cost\", \"pis_cost\", \"health_net_cost\" ), # filter for Aberdeen City partnerships = \"S37000001\" ) # Have used variables which exclude the cost of outpatient attendances which did # not attend (DNA) but you could also include this if needed. # produce summary table output_table_5 <- ab_1819 %>% # rename outatients variable rename(op_cost = op_cost_attend) %>% # sum of all cost variables and number of patients summarise(across(ends_with(\"_cost\"), ~ sum(.x, na.rm = TRUE)), patients = n() ) %>% # switch to rows pivot_longer(everything()) # read in data required from slf episode file - filter for years 2015/16 to 2019/20 deaths <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\", \"1920\"), # select columns col_select = c(\"year\", \"deathdiag1\"), # Filter for death records recids = \"NRS\" ) # extract 3 & 4 digit codes and select those with dementia dementia_deaths <- deaths %>% # extract 3 & 4 digit ICD 10 codes mutate( diag_3d = str_sub(deathdiag1, 1, 3), diag_4d = str_sub(deathdiag1, 1, 4) ) %>% # select dementia codes filter(diag_3d == \"G30\" | diag_3d == \"F00\" | diag_3d == \"F01\" | diag_3d == \"F02\" | diag_3d == \"F03\" | diag_4d == \"F051\") # produce summary table output_table_6 <- dementia_deaths %>% count(year) %>% rename(deaths = n) # read in HSCP names (used in exercises 7 & 9) hscp_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Integration Authority 2019 Lookup.csv\") %>% select( hscp2019 = IntegrationAuthority2019Code, hscp_desc = IntegrationAuthority2019Name ) # read in data required from slf episode file - filter for year = 2018/19 pis_1819 <- read_slf_individual(\"1819\", col_select = c(\"hscp2019\", \"ms\", \"pis_paid_items\", \"pis_cost\") ) # select all patients with MS & add on HSCP name ms_1819 <- pis_1819 %>% filter(ms == 1) %>% left_join(hscp_lookup) # produce summary table output_table_7 <- ms_1819 %>% # group by hscp group_by(hscp2019, hscp_desc) %>% # sum up number of items, costs & patients with MS (not all will have had prescription) summarise( pis_paid_items = sum(pis_paid_items), pis_cost = sum(pis_cost), patients = sum(ms) ) %>% ungroup() %>% # calculate number of items / cost per patient mutate( items_per_patient = pis_paid_items / patients, cost_per_patient = pis_cost / patients ) # extract all deaths in Glasgow City in 1920 - Filter year = 1920 gc_deaths <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"anon_chi\", \"death_date\"), # filter for Glasgow City partnerships = \"S37000015\", # Filter for death records recids = \"NRS\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # exclude duplicates distinct(anon_chi, death_date) # extract all A&E attendances in 1819 & 1920 ae <- read_slf_episode( year = c(\"1819\", \"1920\"), # select columns col_select = c(\"anon_chi\", \"recid\", \"record_keydate1\"), # filter for A&E data recids = \"AE2\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # rename date of attendance rename(attendance_date = record_keydate1) # select A&E attendances for those individuals who are in the GC deaths file ae_gc <- ae %>% # filter A&E attendances for those in deaths file semi_join(gc_deaths) %>% # match on date of death left_join(gc_deaths) # select A&E attendances which are within 3 months of death (counted as 91 days) ae_gc_3m <- ae_gc %>% # create 3 month interval mutate(int_3m = interval(death_date - days(91), death_date)) %>% # flag if attendance is in 3 month interval mutate(att_3m = if_else(attendance_date %within% int_3m, 1, 0)) %>% # select only those attendances in 3 months before death filter(att_3m == 1) # create list of patients with A&E attendance in 3m period pats_ae_3m <- ae_gc_3m %>% # select only chi and attendance flag select(anon_chi, att_3m) %>% # restrict to one row per person distinct() # final output for total number of deaths and number with an A&E attendance in last 3 months output_table_8 <- gc_deaths %>% # match on attendance flag left_join(pats_ae_3m) %>% # summarise total deaths and deaths with A&E attendance in last 3 months summarise( deaths = n(), deaths_with_ae_att = sum(att_3m, na.rm = TRUE) ) %>% # calculate % mutate(prop_ae_3m = deaths_with_ae_att / deaths) # extract data required from episode file smr_1920 <- read_slf_episode( year = \"1920\", col_select = c( \"anon_chi\", \"record_keydate1\", \"record_keydate2\", \"spec\", \"hscp2019\", \"yearstay\", \"cost_total_net\", \"cij_marker\", \"cij_pattype\" ), recids = c(\"01B\", \"GLS\", \"04B\") ) %>% # exclude those with missing chi filter(anon_chi != \"\") # flag episodes in Geriatric Medicine specialty AB smr_1920 <- smr_1920 %>% mutate(ger_med = if_else(spec == \"AB\", 1, 0)) # select only those from non-elective stays smr_1920_ne <- smr_1920 %>% filter(cij_pattype == \"Non-Elective\") # aggregate to cij level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost cij_1920 <- smr_1920_ne %>% arrange(anon_chi, cij_marker, record_keydate1, record_keydate2) %>% group_by(anon_chi, cij_marker) %>% summarise( across(record_keydate1, min), across(c(record_keydate2, ger_med), max), across(c(cij_pattype, hscp2019), last), across(c(yearstay, cost_total_net), sum) ) %>% ungroup() # select only admissions with part of their stay in Geriatric Medicine specialty cij_ger_med <- cij_1920 %>% filter(ger_med == 1) # aggregate up to patient level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost pat_1920 <- cij_ger_med %>% group_by(anon_chi, hscp2019) %>% summarise( across(c(ger_med, yearstay, cost_total_net), sum) ) %>% ungroup() # produce output # note patients may be counted in more than one hscp output_table_9 <- pat_1920 %>% # match on hscp names left_join(hscp_lookup) %>% # group up to hscp level group_by(hscp2019, hscp_desc) %>% # sum up measures summarise( admissions = sum(ger_med), beddays = sum(yearstay), cost = sum(cost_total_net), patients = n() ) %>% ungroup()"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"using-parquet-files-with-the-arrow-package","dir":"Articles","previous_headings":"","what":"Using Parquet files with the arrow package","title":"Using Parquet files with the arrow package","text":"SLFs available parquet format. {arrow} package gives extra features can speed reduce memory usage even . can read specific columns read_parquet(file, col_select = c(var1, var2)). Using arrow’s ‘Arrow Table’ feature, can speed analysis efficiently. , specify as_data_frame = FALSE using SLFhelper dplyr::collect() read data.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"for-example","dir":"Articles","previous_headings":"Using Parquet files with the arrow package","what":"For example:","title":"Using Parquet files with the arrow package","text":"Imagine scenario analysing planned unplanned beddays Scotland, two ways read episode files analysis setting as_data_frame TRUE FALSE follows. specifying as_data_frame = FALSE using reading SLF functions, one enjoys great advantages parquet files. One advantages fast query processing reading necessary columns rather entire rows. table demonstrates huge impact advantages. Comparison different ways reading SLF files","code":"library(slfhelper) ## FAST METHOD # Filter for year of interest slf_extract1 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = FALSE ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay)) %>% # collect the arrow table dplyr::collect() ## SLOW and DEFAULT Method # Filter for year of interest slf_extract2 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = TRUE # which is default ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-only-specified-variables","dir":"Articles","previous_headings":"","what":"Selecting only specified variables","title":"Using variable packs","text":"recommended choose variables need reading Source Linkage File. can achieved specifying col_select argument relevant read_slf_ function. result data read much faster well easy work . full episode individual files 200+ 100+ variables respectively!","code":"library(slfhelper) ep_data <- read_slf_episode(year = 1920, col_select = c(\"year\", \"anon_chi\", \"recid\")) indiv_data <- read_slf_individual(year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-variables-using-tidyselect-functions","dir":"Articles","previous_headings":"","what":"Selecting variables using tidyselect functions","title":"Using variable packs","text":"now allowed use tidyselect functions, contains() start_with(), select variables relevant read_slf_ function. One can also mix tidyselect functions specified variables selecting.","code":"library(slfhelper) ep_data <- read_slf_episode( year = 1920, col_select = !tidyselect::contains(\"keytime\") ) indiv_data <- read_slf_individual( year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\", tidyselect::starts_with(\"sds\")) )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"looking-up-variable-names","dir":"Articles","previous_headings":"","what":"Looking up variable names","title":"Using variable packs","text":"help task picking variables might need analysis, well getting spelling correct, provide lists variable names package.","code":"# Show the first few variables from the episode file head(ep_file_vars) #> [1] \"year\" \"recid\" \"anon_chi\" #> [4] \"postcode\" \"dd_responsible_lca\" \"record_keydate1\" # Do the same for the individual file head(indiv_file_vars) #> [1] \"anon_chi\" \"gender\" \"postcode\" #> [4] \"dob\" \"gpprac\" \"sc_latest_submission\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"variable-packs","dir":"Articles","previous_headings":"","what":"Variable packs","title":"Using variable packs","text":"great can still lot effort copy/pasting every time, especially need quite variables analysis. assist , number ‘variable packs’, groups variables commonly needed together can accessed simple name. Currently four packs; demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Let’s see contain.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"demographic-variables","dir":"Articles","previous_headings":"Variable packs","what":"Demographic variables","title":"Using variable packs","text":"demographic variables specific CHI can used episode individual file.","code":"demog_vars #> [1] \"anon_chi\" \"gender\" #> [3] \"dob\" \"age\" #> [5] \"gpprac\" \"hbpraccode\" #> [7] \"postcode\" \"hbrescode\" #> [9] \"hscp2018\" \"lca\" #> [11] \"ca2018\" \"locality\" #> [13] \"datazone2011\" \"hb2019\" #> [15] \"hscp2019\" \"ca2019\" #> [17] \"simd2020v2_rank\" \"simd2020v2_sc_decile\" #> [19] \"simd2020v2_sc_quintile\" \"simd2020v2_hb2019_decile\" #> [21] \"simd2020v2_hb2019_quintile\" \"simd2020v2_hscp2019_decile\" #> [23] \"simd2020v2_hscp2019_quintile\" \"ur8_2016\" #> [25] \"ur6_2016\" \"ur3_2016\" #> [27] \"ur2_2016\" \"cluster\" #> [29] \"demographic_cohort\" \"service_use_cohort\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"long-term-condition-ltc-variables","dir":"Articles","previous_headings":"Variable packs","what":"Long Term Condition (LTC) variables","title":"Using variable packs","text":"Long Term Condition flag variables specific CHI can used episode individual file.","code":"ltc_vars #> [1] \"arth\" \"asthma\" \"atrialfib\" \"cancer\" \"cvd\" #> [6] \"liver\" \"copd\" \"dementia\" \"diabetes\" \"epilepsy\" #> [11] \"chd\" \"hefailure\" \"ms\" \"parkinsons\" \"refailure\" #> [16] \"congen\" \"bloodbfo\" \"endomet\" \"digestive\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"bedday-variables","dir":"Articles","previous_headings":"Variable packs","what":"Bedday variables","title":"Using variable packs","text":"variables detailing beddays, specific episode can used episode file.","code":"ep_file_bedday_vars #> [1] \"yearstay\" \"stay\" \"apr_beddays\" \"may_beddays\" \"jun_beddays\" #> [6] \"jul_beddays\" \"aug_beddays\" \"sep_beddays\" \"oct_beddays\" \"nov_beddays\" #> [11] \"dec_beddays\" \"jan_beddays\" \"feb_beddays\" \"mar_beddays\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"cost-variables","dir":"Articles","previous_headings":"Variable packs","what":"Cost variables","title":"Using variable packs","text":"variables detailing costs, specific episode can used episode file.","code":"ep_file_cost_vars #> [1] \"cost_total_net\" \"cost_total_net_inc_dnas\" #> [3] \"apr_cost\" \"may_cost\" #> [5] \"jun_cost\" \"jul_cost\" #> [7] \"aug_cost\" \"sep_cost\" #> [9] \"oct_cost\" \"nov_cost\" #> [11] \"dec_cost\" \"jan_cost\" #> [13] \"feb_cost\" \"mar_cost\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"using-variable-packs","dir":"Articles","previous_headings":"","what":"Using variable packs","title":"Using variable packs","text":"variable packs can used column selection simplify code substantially. example take demographic data LTC flags individual file. get bedday information Acute records episode file.","code":"library(slfhelper) indiv_ltc_data <- read_slf_individual(year = 1920, col_select = c(\"year\", demog_vars, ltc_vars)) library(slfhelper) acute_beddays <- read_slf_episode( year = 1920, col_select = c(\"year\", \"anon_chi\", \"hbtreatcode\", \"recid\", ep_file_bedday_vars, \"cij_pattype\"), recid = c(\"01B\", \"GLS\") )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Using variable packs","text":"using column argument reading data increase read speed, reduce amount data loading R. slfhelper provides number helpers make picking using variables need easier. like changes made existing packs, please open issue GitHub. like suggest additional variable packs, either open issue, even submit pull request!","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Public Health Scotland. Copyright holder. James McMahon. Author. Megan McNicol. Maintainer, author. Zihao Li. Author. Jennifer Thom. Author.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"McMahon J, McNicol M, Li Z, Thom J (2024). slfhelper: Useful functions working Source Linkage Files. R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper, https://public-health-scotland.github.io/slfhelper/.","code":"@Manual{, title = {slfhelper: Useful functions for working with the Source Linkage Files}, author = {James McMahon and Megan McNicol and Zihao Li and Jennifer Thom}, year = {2024}, note = {R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper}, url = {https://public-health-scotland.github.io/slfhelper/}, }"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper","dir":"","previous_headings":"","what":"Useful functions for working with the Source Linkage Files","title":"Useful functions for working with the Source Linkage Files","text":"goal slfhelper provide easy--use functions make working Source Linkage Files painless efficient possible. intended use PHS employees work PHS R infrastructure.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Useful functions for working with the Source Linkage Files","text":"simplest way install PHS Posit Workbench environment use PHS Package Manager, default setting means can install slfhelper package. doesn’t work can install directly GitHub, number ways , recommend {pak} package.","code":"install.packages(\"slfhelper\") # Install pak (if needed) install.packages(\"pak\") # Use pak to install slfhelper pak::pak(\"Public-Health-Scotland/slfhelper\")"},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper-articles","dir":"","previous_headings":"Additional Documentation","what":"SLFhelper Articles","title":"Useful functions for working with the Source Linkage Files","text":"created additional documentation help using SLFhelper. new documentation can found : https://public-health-scotland.github.io/slfhelper/ selecting drop Articles. includes: * Memory usage using SLFs Posit * Using arrow package SLFs * Example questions answered using SLFs (full code available) find useful like see topics included future documentation, please get touch team.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"read-a-file","dir":"","previous_headings":"Usage","what":"Read a file","title":"Useful functions for working with the Source Linkage Files","text":"Note: Reading full file quite slow use lot memory, always recommend column selection keep variables need analysis. Just dramatically speed read time. provide data snippets help column selection filtering. options reading files can () combined required.","code":"library(slfhelper) # Get a list of the variables in a file ep_file_vars indiv_file_vars # See a lookup of Partnership names to HSCP_2018 codes View(partnerships) # See a list with descriptions for the recids View(recids) # See a list of Long term conditions View(ltc_vars) # See a list of bedday related variables View(ep_file_bedday_vars) # See a list of cost related variables View(ep_file_cost_vars) library(slfhelper) # Read a group of variables e.g. LTCs (arth, asthma, atrialfib etc) # A nice 'catch all' for reading in all of the LTC variables ep_1718 <- read_slf_episode(\"1718\", col_select = c(\"anon_chi\", ltc_vars)) # Read in a group of variables e.g. bedday related variables (yearstay, stay, apr_beddays etc) # A 'catch all' for reading in bedday related variables ep_1819 <- read_slf_episode(\"1819\", col_select = c(\"anon_chi\", ep_file_bedday_vars)) # Read in a group of variables e.g. cost related variables (cost_total_net, apr_cost) # A 'catch all' for reading in cos related variables ep_1920 <- read_slf_episode(\"1920\", col_select = c(\"anon_chi\", ep_file_cost_vars)) library(slfhelper) # Read certain variables # It's much faster to choose variables like this indiv_1718 <- read_slf_individual(year = \"1718\", col_select = c(\"anon_chi\", \"hri_scot\")) # Read multiple years # This will use dplyr::bind_rows() and return the files added together as a single tibble episode_data <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\"), col_select = c(\"anon_chi\", \"yearstay\") ) # Read only data for a certain partnership (HSCP_2018 code) # This can be a single partnership or multiple by supplying a vector e.g. c(...) indiv_1718 <- read_slf_individual( year = \"1718\", partnerships = \"S37000001\", # Aberdeen City col_select = c(\"anon_chi\", \"hri_scot\") ) # Read only data for a certain recid # This can be a single recid or multiple by supplying a vector e.g. c(...) ep_1718 <- read_slf_episode(\"1718\", recid = c(\"01B\", \"GLS\"), col_select = c(\"anon_chi\", \"yearstay\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"match-on-chi-numbers-to-anon_chi-or-vice-versa","dir":"","previous_headings":"Usage","what":"Match on CHI numbers to Anon_CHI (or vice versa)","title":"Useful functions for working with the Source Linkage Files","text":"","code":"library(slfhelper) # Add real CHI numbers to a SLF ep_1718 <- read_slf_episode(c(\"1718\", \"1819\", \"1920\"), col_select = c(\"year\", \"anon_chi\", \"demographic_cohort\") ) %>% get_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 the cohort sample chi_cohort <- chi_cohort %>% get_anon_chi(chi_var = \"upi_number\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the current user is in a UNIX group — check_has_access","title":"Check if the current user is in a UNIX group — check_has_access","text":"Check current user UNIX group","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the current user is in a UNIX group — check_has_access","text":"","code":"check_has_access(group = \"hscdiip\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the current user is in a UNIX group — check_has_access","text":"group group check, default hscdiip","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the current user is in a UNIX group — check_has_access","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if it's a server session — check_on_server","title":"Check if it's a server session — check_on_server","text":"Check server session","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if it's a server session — check_on_server","text":"","code":"check_on_server()"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if it's a server session — check_on_server","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Check the year(s) supplied are valid — check_year","title":"Check the year(s) supplied are valid — check_year","text":"Check year(s) supplied valid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check the year(s) supplied are valid — check_year","text":"","code":"check_year(year, call = rlang::caller_env())"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check the year(s) supplied are valid — check_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). call Supply environment top-level function make error messages useful.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check the year(s) supplied are valid — check_year","text":"TRUE year valid newer year, FALSE older still valid years. Otherwise throws error.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":null,"dir":"Reference","previous_headings":"","what":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"tibble containing example cohort CHI numbers different variable names. used testing illustrate examples. likely many 'chi numbers' valid.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"","code":"chi_cohort"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"object class tbl_df (inherits tbl, data.frame) 100 rows 2 columns.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Demographic variables — demog_vars","title":"Demographic variables — demog_vars","text":"vector containing names demographic variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Demographic variables — demog_vars","text":"","code":"demog_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Demographic variables — demog_vars","text":"object class character length 30.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file bedday variables — ep_file_bedday_vars","title":"Episode file bedday variables — ep_file_bedday_vars","text":"vector containing names bedday related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file bedday variables — ep_file_bedday_vars","text":"","code":"ep_file_bedday_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file bedday variables — ep_file_bedday_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file cost variables — ep_file_cost_vars","title":"Episode file cost variables — ep_file_cost_vars","text":"vector containing names cost related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file cost variables — ep_file_cost_vars","text":"","code":"ep_file_cost_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file cost variables — ep_file_cost_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file variables — ep_file_vars","title":"Episode file variables — ep_file_vars","text":"names variables episode files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file variables — ep_file_vars","text":"","code":"ep_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file variables — ep_file_vars","text":"object class character length 251.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a year into the correct short FY format — format_year","title":"Format a year into the correct short FY format — format_year","text":"Format year correct short FY format","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a year into the correct short FY format — format_year","text":"","code":"format_year(year)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a year into the correct short FY format — format_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year().","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format a year into the correct short FY format — format_year","text":"Year correctly formatted short FY e.g. '1718'","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Source Linkage File, file path — gen_file_path","title":"Generate a Source Linkage File, file path — gen_file_path","text":"Generate Source Linkage File, file path","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a Source Linkage File, file path — gen_file_path","text":"","code":"gen_file_path(year, file_version, call, dev = FALSE, ext = \"parquet\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a Source Linkage File, file path — gen_file_path","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). call Supply environment top-level function make error messages useful. dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. ext file extension read.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Source Linkage File, file path — gen_file_path","text":"fs_path object.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"Match anon_chi dataset using CHI numbers","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"get_anon_chi(chi_cohort, chi_var = \"chi\", drop = TRUE, check = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"chi_cohort tibble data frame. chi_var CHI variable: name variable containing CHI (default chi). drop Optional boolean indicating whether existing chi_var dropped - default TRUE. check Optional boolean, CHIs checked using phsmethods::chi_check() - default TRUE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"if (FALSE) { # \\dontrun{ chi_cohort %>% get_anon_chi() chi_cohort %>% get_anon_chi(chi_var = \"upi_number\") } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on CHI numbers to a dataset using anon_chi — get_chi","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"Match CHI numbers dataset using anon_chi","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"get_chi(data, anon_chi_var = \"anon_chi\", drop = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"data tibble data frame anon_chi_var Anon CHI variable: name variable containing anonymised CHI (default anon_chi) drop Optional boolean indicating whether existing anon_chi_var dropped - default TRUE","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"if (FALSE) { # \\dontrun{ slf_1718 <- read_slf_individual(\"1718\") get_chi(slf_1718) get_chi(slf_1718, drop = FALSE) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual file variables — indiv_file_vars","title":"Individual file variables — indiv_file_vars","text":"names variables individual files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual file variables — indiv_file_vars","text":"","code":"indiv_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Individual file variables — indiv_file_vars","text":"object class character length 193.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"LTC variables — ltc_vars","title":"LTC variables — ltc_vars","text":"vector containing names Long Term Condition (LTC) variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"LTC variables — ltc_vars","text":"","code":"ltc_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"LTC variables — ltc_vars","text":"object class character length 19.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":null,"dir":"Reference","previous_headings":"","what":"HSCP name / code lookup — partnerships","title":"HSCP name / code lookup — partnerships","text":"tibble containing names codes (hscp2018 configuration) partnerships. used partnership parameter reading files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"HSCP name / code lookup — partnerships","text":"","code":"partnerships"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"HSCP name / code lookup — partnerships","text":"tibble 31 rows 2 variables: partnership_name official name Partnership hscp2018 hscp2018 standard code S370000??","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage File — read_slf","title":"Read a Source Linkage File — read_slf","text":"Read Source Linkage File","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage File — read_slf","text":"","code":"read_slf( year, file_version = c(\"episode\", \"individual\"), dev = FALSE, col_select = NULL, columns = lifecycle::deprecated(), as_data_frame = TRUE, partnerships = NULL, recids = NULL )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage File — read_slf","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). columns columns longer used, use col_select instead. as_data_frame function return tibble (default) Arrow Table? partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage File — read_slf","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage episode file — read_slf_episode","title":"Read a Source Linkage episode file — read_slf_episode","text":"Read Source Linkage episode file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"read_slf_episode( year, col_select = NULL, partnerships = NULL, recids = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage episode file — read_slf_episode","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage episode file — read_slf_episode","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_episode(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\") ) read_slf_episode(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage individual file — read_slf_individual","title":"Read a Source Linkage individual file — read_slf_individual","text":"Read Source Linkage individual file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"read_slf_individual( year, col_select = NULL, partnerships = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage individual file — read_slf_individual","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage individual file — read_slf_individual","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_individual(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"hri_scot\") ) read_slf_individual(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"hri_scot\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":null,"dir":"Reference","previous_headings":"","what":"Recid name / description lookup — recids","title":"Recid name / description lookup — recids","text":"tibble containing names description recids. used recid parameter reading episode files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recid name / description lookup — recids","text":"","code":"recids"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Recid name / description lookup — recids","text":"tibble 18 rows 2 variables: recid short-form recid Description description recid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":null,"dir":"Reference","previous_headings":"","what":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"package provides helper functions working Source Linkage Files (SLFs). functions mainly focused making first steps analysis easier. can read filter files efficiently using minimal code.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"Maintainer: Megan McNicol megan.mcnicol2@phs.scot Authors: James McMahon james.mcmahon@phs.scot (ORCID) Zihao Li zihao.li@phs.scot (ORCID) Jennifer Thom jennifer.thom@phs.scot contributors: Public Health Scotland phs.source@phs.scot [copyright holder]","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0104","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.4","title":"slfhelper 0.10.4","text":"Bug - Fix build tests New feature - Additional documentation Update README.md Bug - Fix tidyselect feature bug","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0103","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.3","title":"slfhelper 0.10.3","text":"New feature - use tidyselect col_selectin read_slf_episode read_slf_individual.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0102","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.2","title":"slfhelper 0.10.2","text":"Update README.md change episode file cost variable vector force keytime format hms","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0101","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.1","title":"slfhelper 0.10.1","text":"Update README.Rmd Bug - speed get_chi()","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0100","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.0","title":"slfhelper 0.10.0","text":"{glue} longer dependency required functionality can provided `stringr::str_glue(). Dependency versions updated latest. get_chi() get_anon_chi() now properly match missing (NA) blank (\"\") values. slfhelper now defaults using .parquet file versions, old versions slfhelper longer work. now dev parameter available using read_slf_* functions allows reading file development environment.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-090","dir":"Changelog","previous_headings":"","what":"slfhelper 0.9.0","title":"slfhelper 0.9.0","text":"{openssl} now required. get_chi() get_anon_chi() now much faster (>100X) use significantly less memory. year parameter now checked early process, invalid year supplied error message much informative.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-082","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.2","title":"slfhelper 0.8.2","text":"ep_file_vars indiv_file_vars updated correct variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-081","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.1","title":"slfhelper 0.8.1","text":"Use cli nicer error messages warning.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-080","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.0","title":"slfhelper 0.8.0","text":"Add number ‘variable packs’ easily selecting sets variables: demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Add new vignette introducing variable packs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-071","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.1","title":"slfhelper 0.7.1","text":"Add check server hscdiip access package load. Add recid lookup use recid filtering parameter. using get_anon_chi() now use phsmethods::chi_check (available) warn lot CHI numbers return invalid. Update variable lists new Home Care related variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-070","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.0","title":"slfhelper 0.7.0","text":"Now depends R >= 3.5 ep_file_vars indiv_file_vars updated latest variable names. now also return character vector instead list. read_slf_ now returns tibble.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-060","dir":"Changelog","previous_headings":"","what":"slfhelper 0.6.0","title":"slfhelper 0.6.0","text":"Fix bug selecting partnerships/recids also selecting multiple years (#13) (#14)","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-053","dir":"Changelog","previous_headings":"","what":"slfhelper 0.5.3","title":"slfhelper 0.5.3","text":"Added NEWS.md file track changes package. Moved use Rmd version readme. Bump dplyr version requirement 1.0.0 enable use across() new things. Add checks year","code":""}]
+[{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to slfhelper","title":"Contributing to slfhelper","text":"outlines propose change slfhelper.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to slfhelper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to slfhelper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to slfhelper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"Public-Health-Scotland/slfhelper\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to slfhelper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to slfhelper","text":"Please note slfhelper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2019 James McMahon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with slfhelper","title":"Getting help with slfhelper","text":"Thanks using slfhelper! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with slfhelper","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with slfhelper","text":"Armed reprex, next step figure ask. ’s question: start SLF Teams channel. ’s bug: ’re right place, file issue. ’re sure: feel free either! opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"slfhelper","dir":"Articles","previous_headings":"","what":"SLFhelper","title":"slf-documentation","text":"SLFhelper contains easy use functions designed make working Source Linkage Files (SLFs) efficient possible.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"filter-functions","dir":"Articles","previous_headings":"SLFhelper","what":"Filter functions:","title":"slf-documentation","text":"year returns financial year interest. can also select multiple years using c(\"1718\", \"1819\", \"1920\") recid returns recids interest. Selecting beneficial specific analysis. partnerships returns partnerships interest. Selecting certain partnerships reduce SLFs size. col_select returns columns interest. best way reduce SLFs size.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"data-snippets","dir":"Articles","previous_headings":"SLFhelper","what":"Data snippets:","title":"slf-documentation","text":"ep_file_vars returns list variables episode files. indiv_file_vars returns list variables individual files. partnerships returns list partnership names (HSCP_2018 codes) recid returns list recids available SLFs. ep_file_bedday_vars returns list bedday related variables SLFs. ep_file_cost_vars returns list cost related variables SLFs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"anon-chi","dir":"Articles","previous_headings":"SLFhelper","what":"Anon CHI","title":"slf-documentation","text":"Use function get_chi() easily switch anon_chi chi. Use function get_anon_chi() easily switch chi anon_chi.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"memory-usage-in-slfs","dir":"Articles","previous_headings":"SLFhelper","what":"Memory usage in SLFS","title":"slf-documentation","text":"working Source Linkage Files (SLFs), recommended use features SLFhelper package maximase memory usage posit, see PHS Data Science Knowledge Base guidance memory usage posit workbench. Reading full SLF file can time consuming take resources posit workbench. episode file 251 variables around 12 million rows compared individual file 193 variables around 6 million rows file. can reduced using available selections SLFhelper help reduce size SLFs analysis free resources posit workbench. tables show memory usage full size SLF.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slf-documentation.html","id":"individual-file","dir":"Articles","previous_headings":"SLFhelper > Memory usage in SLFS","what":"Individual File","title":"slf-documentation","text":"one can use selection features SLFhelper, session memory requirement can reduced. 251 columns year episode file size around 20 GiB. Hence, average, column rows takes around 0.1 GiB, can give rough estimate session memory one needs. Taking Year 1920 demonstration, following tables present various sizes extracts SLF files, 5 columns columns, along amount memory required work data one reads . Keep mind tables just recommendations, memory usage depends one handles data optimises data pipeline.","code":""},{"path":[]},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/articles/slfhelper-applications.html","id":"examples-using-slfhelper","dir":"Articles","previous_headings":"","what":"Examples using SLFhelper","title":"slfhelper-applications","text":"&E attendances East Lothian age group. Produce table compare &E Attendances following age groups (0-17, 18-64, 65-74, 75-84, 85+) 2018/19 East Lothian HSCP. Outpatient attendances specialty gender. Create table compare number outpatient attendances (SMR00) broken specialty gender 2017/18 Scotland. Hospital admissions & beddays HB residence. Produce table compare number admissions, bed days average length stay (split elective non-elective) Health Board Residence 2018/19. GP Hours Consulations South Ayrshire. Create table showing number GP Hours consultations patients dementia South Ayrshire HSCP 2019/20 broken type consultation. Costs Aberdeen City. Produce table show number patients total costs Aberdeen City HSCP 2018/19. Include breakdown costs following services: Acute (inpatients & daycases), GLS, Mental Health Maternity, Outpatients, &E, GP Hours, Community Prescribing. Deaths Dementia / Alzheimers Produce chart show number deaths 2015/16 2019/20 Scotland main cause death recorded Dementia/Alzheimers (ICD 10 codes: G30, F01-F03, F05.1). Number cost prescriptions MS Create table compare number cost prescribed items patients Multiple Sclerosis (MS) HSCP 2018/19. Include number dispensed items cost per patient. &E attendance last 3 months life. Produce table show number deaths Glasgow City HSCP 2019/20 proportion &E attendance last 3 months life. Non elective admissions Geriatric Medicine. Create table showing number non-elective admissions part stay (Continuous Inpatient Journey, CIJ) specialty Geriatric Medicine, HSCP 2019/20. Also include associated bed days, cost number patients.","code":"# read in data required from slf individual file - filter for year 2018/19 el_1819 <- read_slf_individual( year = \"1819\", # select variables needed col_select = c(\"age\", \"ae_attendances\"), # filter partnership for East Lothian partnerships = \"S37000010\" ) # create age bands age_labs <- c(\"0-17\", \"18-64\", \"65-74\", \"75-84\", \"85+\") # create age labels # create age group variable el_1819 <- el_1819 %>% mutate(age_group = cut(age, breaks = c(-1, 17, 64, 74, 84, 150), labels = age_labs )) # produce summary table output_table_1 <- el_1819 %>% group_by(age_group) %>% summarise(attendances = sum(ae_attendances)) %>% ungroup() # read in specialty lookup with names spec_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/National Reference Files/Specialty.csv\") %>% select( spec = Speccode, spec_name = Description ) # read in data required from slf episode file - filter year = 2017/18 op_1718 <- read_slf_episode( year = \"1718\", # select columns col_select = c(\"recid\", \"gender\", \"spec\"), # filter on recid for outpatients recids = \"00B\" ) # produce output output_table_2 <- op_1718 %>% # get counts by specialty and gender count(spec, gender) %>% # exclude those with no gender recorded filter(gender == 1 | gender == 2) %>% # recode gender into M/F mutate(gender = recode(as.character(gender), \"1\" = \"Male\", \"2\" = \"Female\")) %>% # move gender to separate columns pivot_wider(names_from = gender, values_from = n) %>% # match on specialty names left_join(spec_lookup) %>% # reorder variables select(spec, spec_name, Male, Female) # Read in names for Health Boards hb_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Health Board Area 2019 Lookup.csv\") %>% select( hb2019 = HealthBoardArea2019Code, hb_desc = HealthBoardArea2019Name ) # read in data required from slf individual file - filter for 2018/19 indiv_1819 <- read_slf_individual( year = \"1819\", # Select columns of interest col_select = c( \"hb2019\", \"cij_el\", \"cij_non_el\", \"acute_el_inpatient_beddays\", \"mh_el_inpatient_beddays\", \"gls_el_inpatient_beddays\", \"acute_non_el_inpatient_beddays\", \"mh_non_el_inpatient_beddays\", \"gls_non_el_inpatient_beddays\" ) ) # calculate total bed days and add on HB names indiv_1819_inc_totals <- indiv_1819 %>% # calculate overall bed days mutate( elective_beddays = acute_el_inpatient_beddays + mh_el_inpatient_beddays + gls_el_inpatient_beddays, non_elective_beddays = acute_non_el_inpatient_beddays + mh_non_el_inpatient_beddays + gls_non_el_inpatient_beddays ) %>% # match on HB name left_join(hb_lookup) # produce summary table output_table_3 <- indiv_1819_inc_totals %>% # group by HB of residence group_by(hb2019, hb_desc) %>% # produce summary table summarise( elective_adm = sum(cij_el), non_elective_adm = sum(cij_non_el), elective_beddays = sum(elective_beddays), non_elective_beddays = sum(non_elective_beddays) ) %>% # calculate average length of stay mutate( elective_alos = elective_beddays / elective_adm, non_elective_alos = non_elective_beddays / non_elective_adm ) # read in data required from slf episode file - filter for year = 2019/20 sa_1920 <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"dementia\", \"smrtype\"), # filter for South Ayrshire HSCP partnerships = \"S37000027\", # Filter for GP OOH data recids = \"OoH\" ) # select dementia patients sa_dementia_1920 <- sa_1920 %>% filter(dementia == 1) # produce summary table output_table_4 <- sa_dementia_1920 %>% count(smrtype) # read in data required from slf individual file - filter year = 2018/19 ab_1819 <- read_slf_individual( year = \"1819\", # select columns col_select = c( \"acute_cost\", \"gls_cost\", \"mh_cost\", \"mat_cost\", \"op_cost_attend\", \"ae_cost\", \"ooh_cost\", \"pis_cost\", \"health_net_cost\" ), # filter for Aberdeen City partnerships = \"S37000001\" ) # Have used variables which exclude the cost of outpatient attendances which did # not attend (DNA) but you could also include this if needed. # produce summary table output_table_5 <- ab_1819 %>% # rename outatients variable rename(op_cost = op_cost_attend) %>% # sum of all cost variables and number of patients summarise(across(ends_with(\"_cost\"), ~ sum(.x, na.rm = TRUE)), patients = n() ) %>% # switch to rows pivot_longer(everything()) # read in data required from slf episode file - filter for years 2015/16 to 2019/20 deaths <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\", \"1920\"), # select columns col_select = c(\"year\", \"deathdiag1\"), # Filter for death records recids = \"NRS\" ) # extract 3 & 4 digit codes and select those with dementia dementia_deaths <- deaths %>% # extract 3 & 4 digit ICD 10 codes mutate( diag_3d = str_sub(deathdiag1, 1, 3), diag_4d = str_sub(deathdiag1, 1, 4) ) %>% # select dementia codes filter(diag_3d == \"G30\" | diag_3d == \"F00\" | diag_3d == \"F01\" | diag_3d == \"F02\" | diag_3d == \"F03\" | diag_4d == \"F051\") # produce summary table output_table_6 <- dementia_deaths %>% count(year) %>% rename(deaths = n) # read in HSCP names (used in exercises 7 & 9) hscp_lookup <- read_csv(\"/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory/Codes and Names/Integration Authority 2019 Lookup.csv\") %>% select( hscp2019 = IntegrationAuthority2019Code, hscp_desc = IntegrationAuthority2019Name ) # read in data required from slf episode file - filter for year = 2018/19 pis_1819 <- read_slf_individual(\"1819\", col_select = c(\"hscp2019\", \"ms\", \"pis_paid_items\", \"pis_cost\") ) # select all patients with MS & add on HSCP name ms_1819 <- pis_1819 %>% filter(ms == 1) %>% left_join(hscp_lookup) # produce summary table output_table_7 <- ms_1819 %>% # group by hscp group_by(hscp2019, hscp_desc) %>% # sum up number of items, costs & patients with MS (not all will have had prescription) summarise( pis_paid_items = sum(pis_paid_items), pis_cost = sum(pis_cost), patients = sum(ms) ) %>% ungroup() %>% # calculate number of items / cost per patient mutate( items_per_patient = pis_paid_items / patients, cost_per_patient = pis_cost / patients ) # extract all deaths in Glasgow City in 1920 - Filter year = 1920 gc_deaths <- read_slf_episode( year = \"1920\", # select columns col_select = c(\"anon_chi\", \"death_date\"), # filter for Glasgow City partnerships = \"S37000015\", # Filter for death records recids = \"NRS\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # exclude duplicates distinct(anon_chi, death_date) # extract all A&E attendances in 1819 & 1920 ae <- read_slf_episode( year = c(\"1819\", \"1920\"), # select columns col_select = c(\"anon_chi\", \"recid\", \"record_keydate1\"), # filter for A&E data recids = \"AE2\" ) %>% # exclude those with missing chi filter(anon_chi != \"\") %>% # rename date of attendance rename(attendance_date = record_keydate1) # select A&E attendances for those individuals who are in the GC deaths file ae_gc <- ae %>% # filter A&E attendances for those in deaths file semi_join(gc_deaths) %>% # match on date of death left_join(gc_deaths) # select A&E attendances which are within 3 months of death (counted as 91 days) ae_gc_3m <- ae_gc %>% # create 3 month interval mutate(int_3m = interval(death_date - days(91), death_date)) %>% # flag if attendance is in 3 month interval mutate(att_3m = if_else(attendance_date %within% int_3m, 1, 0)) %>% # select only those attendances in 3 months before death filter(att_3m == 1) # create list of patients with A&E attendance in 3m period pats_ae_3m <- ae_gc_3m %>% # select only chi and attendance flag select(anon_chi, att_3m) %>% # restrict to one row per person distinct() # final output for total number of deaths and number with an A&E attendance in last 3 months output_table_8 <- gc_deaths %>% # match on attendance flag left_join(pats_ae_3m) %>% # summarise total deaths and deaths with A&E attendance in last 3 months summarise( deaths = n(), deaths_with_ae_att = sum(att_3m, na.rm = TRUE) ) %>% # calculate % mutate(prop_ae_3m = deaths_with_ae_att / deaths) # extract data required from episode file smr_1920 <- read_slf_episode( year = \"1920\", col_select = c( \"anon_chi\", \"record_keydate1\", \"record_keydate2\", \"spec\", \"hscp2019\", \"yearstay\", \"cost_total_net\", \"cij_marker\", \"cij_pattype\" ), recids = c(\"01B\", \"GLS\", \"04B\") ) %>% # exclude those with missing chi filter(anon_chi != \"\") # flag episodes in Geriatric Medicine specialty AB smr_1920 <- smr_1920 %>% mutate(ger_med = if_else(spec == \"AB\", 1, 0)) # select only those from non-elective stays smr_1920_ne <- smr_1920 %>% filter(cij_pattype == \"Non-Elective\") # aggregate to cij level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost cij_1920 <- smr_1920_ne %>% arrange(anon_chi, cij_marker, record_keydate1, record_keydate2) %>% group_by(anon_chi, cij_marker) %>% summarise( across(record_keydate1, min), across(c(record_keydate2, ger_med), max), across(c(cij_pattype, hscp2019), last), across(c(yearstay, cost_total_net), sum) ) %>% ungroup() # select only admissions with part of their stay in Geriatric Medicine specialty cij_ger_med <- cij_1920 %>% filter(ger_med == 1) # aggregate up to patient level # we want to keep eariest admission and latest discharge, keep flag if any episode was in spec AB # take hscp from the last record and sum beddays & cost pat_1920 <- cij_ger_med %>% group_by(anon_chi, hscp2019) %>% summarise( across(c(ger_med, yearstay, cost_total_net), sum) ) %>% ungroup() # produce output # note patients may be counted in more than one hscp output_table_9 <- pat_1920 %>% # match on hscp names left_join(hscp_lookup) %>% # group up to hscp level group_by(hscp2019, hscp_desc) %>% # sum up measures summarise( admissions = sum(ger_med), beddays = sum(yearstay), cost = sum(cost_total_net), patients = n() ) %>% ungroup()"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"using-parquet-files-with-the-arrow-package","dir":"Articles","previous_headings":"","what":"Using Parquet files with the arrow package","title":"Using Parquet files with the arrow package","text":"SLFs available parquet format. {arrow} package gives extra features can speed reduce memory usage even . can read specific columns read_parquet(file, col_select = c(var1, var2)). Using arrow’s ‘Arrow Table’ feature, can speed analysis efficiently. , specify as_data_frame = FALSE using SLFhelper dplyr::collect() read data.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/using-arrow-table.html","id":"for-example","dir":"Articles","previous_headings":"Using Parquet files with the arrow package","what":"For example:","title":"Using Parquet files with the arrow package","text":"Imagine scenario analysing planned unplanned beddays Scotland, two ways read episode files analysis setting as_data_frame TRUE FALSE follows. specifying as_data_frame = FALSE using reading SLF functions, one enjoys great advantages parquet files. One advantages fast query processing reading necessary columns rather entire rows. table demonstrates huge impact advantages. Comparison different ways reading SLF files","code":"library(slfhelper) ## FAST METHOD # Filter for year of interest slf_extract1 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = FALSE ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay)) %>% # collect the arrow table dplyr::collect() ## SLOW and DEFAULT Method # Filter for year of interest slf_extract2 <- read_slf_episode(c(\"1819\", \"1920\"), # Select recids of interest recids = c(\"01B\", \"GLS\", \"04B\"), # Select columns col_select = c( \"year\", \"anon_chi\", \"recid\", \"yearstay\", \"age\", \"cij_pattype\" ), # return an arrow table as_data_frame = TRUE # which is default ) %>% # Filter for non-elective and elective episodes dplyr::filter(cij_pattype == \"Non-Elective\" | cij_pattype == \"Elective\") %>% # Group by year and cij_pattype for analysis dplyr::group_by(year, cij_pattype) %>% # summarise bedday totals dplyr::summarise(beddays = sum(yearstay))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-only-specified-variables","dir":"Articles","previous_headings":"","what":"Selecting only specified variables","title":"Using variable packs","text":"recommended choose variables need reading Source Linkage File. can achieved specifying col_select argument relevant read_slf_ function. result data read much faster well easy work . full episode individual files 200+ 100+ variables respectively!","code":"library(slfhelper) ep_data <- read_slf_episode(year = 1920, col_select = c(\"year\", \"anon_chi\", \"recid\")) indiv_data <- read_slf_individual(year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"selecting-variables-using-tidyselect-functions","dir":"Articles","previous_headings":"","what":"Selecting variables using tidyselect functions","title":"Using variable packs","text":"now allowed use tidyselect functions, contains() start_with(), select variables relevant read_slf_ function. One can also mix tidyselect functions specified variables selecting.","code":"library(slfhelper) ep_data <- read_slf_episode( year = 1920, col_select = !tidyselect::contains(\"keytime\") ) indiv_data <- read_slf_individual( year = 1920, col_select = c(\"year\", \"anon_chi\", \"nsu\", tidyselect::starts_with(\"sds\")) )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"looking-up-variable-names","dir":"Articles","previous_headings":"","what":"Looking up variable names","title":"Using variable packs","text":"help task picking variables might need analysis, well getting spelling correct, provide lists variable names package.","code":"# Show the first few variables from the episode file head(ep_file_vars) #> [1] \"year\" \"recid\" \"record_keydate1\" \"record_keydate2\" #> [5] \"smrtype\" \"anon_chi\" # Do the same for the individual file head(indiv_file_vars) #> [1] \"anon_chi\" \"gender\" \"postcode\" #> [4] \"dob\" \"gpprac\" \"sc_latest_submission\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"variable-packs","dir":"Articles","previous_headings":"","what":"Variable packs","title":"Using variable packs","text":"great can still lot effort copy/pasting every time, especially need quite variables analysis. assist , number ‘variable packs’, groups variables commonly needed together can accessed simple name. Currently four packs; demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Let’s see contain.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"demographic-variables","dir":"Articles","previous_headings":"Variable packs","what":"Demographic variables","title":"Using variable packs","text":"demographic variables specific CHI can used episode individual file.","code":"demog_vars #> [1] \"anon_chi\" \"gender\" #> [3] \"dob\" \"age\" #> [5] \"gpprac\" \"hbpraccode\" #> [7] \"postcode\" \"hbrescode\" #> [9] \"hscp2018\" \"lca\" #> [11] \"ca2018\" \"locality\" #> [13] \"datazone2011\" \"hb2019\" #> [15] \"hscp2019\" \"ca2019\" #> [17] \"simd2020v2_rank\" \"simd2020v2_sc_decile\" #> [19] \"simd2020v2_sc_quintile\" \"simd2020v2_hb2019_decile\" #> [21] \"simd2020v2_hb2019_quintile\" \"simd2020v2_hscp2019_decile\" #> [23] \"simd2020v2_hscp2019_quintile\" \"ur8_2016\" #> [25] \"ur6_2016\" \"ur3_2016\" #> [27] \"ur2_2016\" \"cluster\" #> [29] \"demographic_cohort\" \"service_use_cohort\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"long-term-condition-ltc-variables","dir":"Articles","previous_headings":"Variable packs","what":"Long Term Condition (LTC) variables","title":"Using variable packs","text":"Long Term Condition flag variables specific CHI can used episode individual file.","code":"ltc_vars #> [1] \"arth\" \"asthma\" \"atrialfib\" \"cancer\" \"cvd\" #> [6] \"liver\" \"copd\" \"dementia\" \"diabetes\" \"epilepsy\" #> [11] \"chd\" \"hefailure\" \"ms\" \"parkinsons\" \"refailure\" #> [16] \"congen\" \"bloodbfo\" \"endomet\" \"digestive\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"bedday-variables","dir":"Articles","previous_headings":"Variable packs","what":"Bedday variables","title":"Using variable packs","text":"variables detailing beddays, specific episode can used episode file.","code":"ep_file_bedday_vars #> [1] \"yearstay\" \"stay\" \"apr_beddays\" \"may_beddays\" \"jun_beddays\" #> [6] \"jul_beddays\" \"aug_beddays\" \"sep_beddays\" \"oct_beddays\" \"nov_beddays\" #> [11] \"dec_beddays\" \"jan_beddays\" \"feb_beddays\" \"mar_beddays\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"cost-variables","dir":"Articles","previous_headings":"Variable packs","what":"Cost variables","title":"Using variable packs","text":"variables detailing costs, specific episode can used episode file.","code":"ep_file_cost_vars #> [1] \"cost_total_net\" \"cost_total_net_inc_dnas\" #> [3] \"apr_cost\" \"may_cost\" #> [5] \"jun_cost\" \"jul_cost\" #> [7] \"aug_cost\" \"sep_cost\" #> [9] \"oct_cost\" \"nov_cost\" #> [11] \"dec_cost\" \"jan_cost\" #> [13] \"feb_cost\" \"mar_cost\""},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"using-variable-packs","dir":"Articles","previous_headings":"","what":"Using variable packs","title":"Using variable packs","text":"variable packs can used column selection simplify code substantially. example take demographic data LTC flags individual file. get bedday information Acute records episode file.","code":"library(slfhelper) indiv_ltc_data <- read_slf_individual(year = 1920, col_select = c(\"year\", demog_vars, ltc_vars)) library(slfhelper) acute_beddays <- read_slf_episode( year = 1920, col_select = c(\"year\", \"anon_chi\", \"hbtreatcode\", \"recid\", ep_file_bedday_vars, \"cij_pattype\"), recid = c(\"01B\", \"GLS\") )"},{"path":"https://public-health-scotland.github.io/slfhelper/articles/variable-packs.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Using variable packs","text":"using column argument reading data increase read speed, reduce amount data loading R. slfhelper provides number helpers make picking using variables need easier. like changes made existing packs, please open issue GitHub. like suggest additional variable packs, either open issue, even submit pull request!","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Public Health Scotland. Copyright holder. James McMahon. Author. Megan McNicol. Maintainer, author. Zihao Li. Author. Jennifer Thom. Author.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"McMahon J, McNicol M, Li Z, Thom J (2024). slfhelper: Useful functions working Source Linkage Files. R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper, https://public-health-scotland.github.io/slfhelper/.","code":"@Manual{, title = {slfhelper: Useful functions for working with the Source Linkage Files}, author = {James McMahon and Megan McNicol and Zihao Li and Jennifer Thom}, year = {2024}, note = {R package version 0.10.4, https://github.com/Public-Health-Scotland/slfhelper}, url = {https://public-health-scotland.github.io/slfhelper/}, }"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper","dir":"","previous_headings":"","what":"Useful functions for working with the Source Linkage Files","title":"Useful functions for working with the Source Linkage Files","text":"goal slfhelper provide easy--use functions make working Source Linkage Files painless efficient possible. intended use PHS employees work PHS R infrastructure.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Useful functions for working with the Source Linkage Files","text":"simplest way install PHS Posit Workbench environment use PHS Package Manager, default setting means can install slfhelper package. doesn’t work can install directly GitHub, number ways , recommend {pak} package.","code":"install.packages(\"slfhelper\") # Install pak (if needed) install.packages(\"pak\") # Use pak to install slfhelper pak::pak(\"Public-Health-Scotland/slfhelper\")"},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"slfhelper-articles","dir":"","previous_headings":"Additional Documentation","what":"SLFhelper Articles","title":"Useful functions for working with the Source Linkage Files","text":"created additional documentation help using SLFhelper. new documentation can found : https://public-health-scotland.github.io/slfhelper/ selecting drop Articles. includes: * Memory usage using SLFs Posit * Using arrow package SLFs * Example questions answered using SLFs (full code available) find useful like see topics included future documentation, please get touch team.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"read-a-file","dir":"","previous_headings":"Usage","what":"Read a file","title":"Useful functions for working with the Source Linkage Files","text":"Note: Reading full file quite slow use lot memory, always recommend column selection keep variables need analysis. Just dramatically speed read time. provide data snippets help column selection filtering. options reading files can () combined required.","code":"library(slfhelper) # Get a list of the variables in a file ep_file_vars indiv_file_vars # See a lookup of Partnership names to HSCP_2018 codes View(partnerships) # See a list with descriptions for the recids View(recids) # See a list of Long term conditions View(ltc_vars) # See a list of bedday related variables View(ep_file_bedday_vars) # See a list of cost related variables View(ep_file_cost_vars) library(slfhelper) # Read a group of variables e.g. LTCs (arth, asthma, atrialfib etc) # A nice 'catch all' for reading in all of the LTC variables ep_1718 <- read_slf_episode(\"1718\", col_select = c(\"anon_chi\", ltc_vars)) # Read in a group of variables e.g. bedday related variables (yearstay, stay, apr_beddays etc) # A 'catch all' for reading in bedday related variables ep_1819 <- read_slf_episode(\"1819\", col_select = c(\"anon_chi\", ep_file_bedday_vars)) # Read in a group of variables e.g. cost related variables (cost_total_net, apr_cost) # A 'catch all' for reading in cos related variables ep_1920 <- read_slf_episode(\"1920\", col_select = c(\"anon_chi\", ep_file_cost_vars)) library(slfhelper) # Read certain variables # It's much faster to choose variables like this indiv_1718 <- read_slf_individual(year = \"1718\", col_select = c(\"anon_chi\", \"hri_scot\")) # Read multiple years # This will use dplyr::bind_rows() and return the files added together as a single tibble episode_data <- read_slf_episode( year = c(\"1516\", \"1617\", \"1718\", \"1819\"), col_select = c(\"anon_chi\", \"yearstay\") ) # Read only data for a certain partnership (HSCP_2018 code) # This can be a single partnership or multiple by supplying a vector e.g. c(...) indiv_1718 <- read_slf_individual( year = \"1718\", partnerships = \"S37000001\", # Aberdeen City col_select = c(\"anon_chi\", \"hri_scot\") ) # Read only data for a certain recid # This can be a single recid or multiple by supplying a vector e.g. c(...) ep_1718 <- read_slf_episode(\"1718\", recid = c(\"01B\", \"GLS\"), col_select = c(\"anon_chi\", \"yearstay\"))"},{"path":"https://public-health-scotland.github.io/slfhelper/index.html","id":"match-on-chi-numbers-to-anon_chi-or-vice-versa","dir":"","previous_headings":"Usage","what":"Match on CHI numbers to Anon_CHI (or vice versa)","title":"Useful functions for working with the Source Linkage Files","text":"","code":"library(slfhelper) # Add real CHI numbers to a SLF ep_1718 <- read_slf_episode(c(\"1718\", \"1819\", \"1920\"), col_select = c(\"year\", \"anon_chi\", \"demographic_cohort\") ) %>% get_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 the cohort sample chi_cohort <- chi_cohort %>% get_anon_chi(chi_var = \"upi_number\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the current user is in a UNIX group — check_has_access","title":"Check if the current user is in a UNIX group — check_has_access","text":"Check current user UNIX group","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the current user is in a UNIX group — check_has_access","text":"","code":"check_has_access(group = \"hscdiip\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the current user is in a UNIX group — check_has_access","text":"group group check, default hscdiip","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_has_access.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the current user is in a UNIX group — check_has_access","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if it's a server session — check_on_server","title":"Check if it's a server session — check_on_server","text":"Check server session","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if it's a server session — check_on_server","text":"","code":"check_on_server()"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_on_server.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if it's a server session — check_on_server","text":"Boolean","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Check the year(s) supplied are valid — check_year","title":"Check the year(s) supplied are valid — check_year","text":"Check year(s) supplied valid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check the year(s) supplied are valid — check_year","text":"","code":"check_year(year, call = rlang::caller_env())"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check the year(s) supplied are valid — check_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). call Supply environment top-level function make error messages useful.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/check_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check the year(s) supplied are valid — check_year","text":"TRUE year valid newer year, FALSE older still valid years. Otherwise throws error.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":null,"dir":"Reference","previous_headings":"","what":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"tibble containing example cohort CHI numbers different variable names. used testing illustrate examples. likely many 'chi numbers' valid.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"","code":"chi_cohort"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/chi_cohort.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A tibble containing an example cohort of CHI numbers under different variable names. It is used for testing and to illustrate examples. It is likely that many of the 'chi numbers' are not valid. — chi_cohort","text":"object class tbl_df (inherits tbl, data.frame) 100 rows 2 columns.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Demographic variables — demog_vars","title":"Demographic variables — demog_vars","text":"vector containing names demographic variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Demographic variables — demog_vars","text":"","code":"demog_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/demog_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Demographic variables — demog_vars","text":"object class character length 30.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file bedday variables — ep_file_bedday_vars","title":"Episode file bedday variables — ep_file_bedday_vars","text":"vector containing names bedday related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file bedday variables — ep_file_bedday_vars","text":"","code":"ep_file_bedday_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_bedday_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file bedday variables — ep_file_bedday_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file cost variables — ep_file_cost_vars","title":"Episode file cost variables — ep_file_cost_vars","text":"vector containing names cost related variables episode file.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file cost variables — ep_file_cost_vars","text":"","code":"ep_file_cost_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_cost_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file cost variables — ep_file_cost_vars","text":"object class character length 14.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Episode file variables — ep_file_vars","title":"Episode file variables — ep_file_vars","text":"names variables episode files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Episode file variables — ep_file_vars","text":"","code":"ep_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ep_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Episode file variables — ep_file_vars","text":"object class character length 251.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a year into the correct short FY format — format_year","title":"Format a year into the correct short FY format — format_year","text":"Format year correct short FY format","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a year into the correct short FY format — format_year","text":"","code":"format_year(year)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a year into the correct short FY format — format_year","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year().","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/format_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format a year into the correct short FY format — format_year","text":"Year correctly formatted short FY e.g. '1718'","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Source Linkage File, file path — gen_file_path","title":"Generate a Source Linkage File, file path — gen_file_path","text":"Generate Source Linkage File, file path","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a Source Linkage File, file path — gen_file_path","text":"","code":"gen_file_path(year, file_version, call, dev = FALSE, ext = \"parquet\")"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a Source Linkage File, file path — gen_file_path","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). call Supply environment top-level function make error messages useful. dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. ext file extension read.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/gen_file_path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Source Linkage File, file path — gen_file_path","text":"fs_path object.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"Match anon_chi dataset using CHI numbers","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"get_anon_chi(chi_cohort, chi_var = \"chi\", drop = TRUE, check = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"chi_cohort tibble data frame. chi_var CHI variable: name variable containing CHI (default chi). drop Optional boolean indicating whether existing chi_var dropped - default TRUE. check Optional boolean, CHIs checked using phsmethods::chi_check() - default TRUE.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_anon_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on anon_chi to a dataset using CHI numbers — get_anon_chi","text":"","code":"if (FALSE) { # \\dontrun{ chi_cohort %>% get_anon_chi() chi_cohort %>% get_anon_chi(chi_var = \"upi_number\") } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":null,"dir":"Reference","previous_headings":"","what":"Match on CHI numbers to a dataset using anon_chi — get_chi","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"Match CHI numbers dataset using anon_chi","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"get_chi(data, anon_chi_var = \"anon_chi\", drop = TRUE)"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"data tibble data frame anon_chi_var Anon CHI variable: name variable containing anonymised CHI (default anon_chi) drop Optional boolean indicating whether existing anon_chi_var dropped - default TRUE","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"tibble","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/get_chi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match on CHI numbers to a dataset using anon_chi — get_chi","text":"","code":"if (FALSE) { # \\dontrun{ slf_1718 <- read_slf_individual(\"1718\") get_chi(slf_1718) get_chi(slf_1718, drop = FALSE) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual file variables — indiv_file_vars","title":"Individual file variables — indiv_file_vars","text":"names variables individual files, correct order.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual file variables — indiv_file_vars","text":"","code":"indiv_file_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/indiv_file_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Individual file variables — indiv_file_vars","text":"object class character length 193.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":null,"dir":"Reference","previous_headings":"","what":"LTC variables — ltc_vars","title":"LTC variables — ltc_vars","text":"vector containing names Long Term Condition (LTC) variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"LTC variables — ltc_vars","text":"","code":"ltc_vars"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/ltc_vars.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"LTC variables — ltc_vars","text":"object class character length 19.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":null,"dir":"Reference","previous_headings":"","what":"HSCP name / code lookup — partnerships","title":"HSCP name / code lookup — partnerships","text":"tibble containing names codes (hscp2018 configuration) partnerships. used partnership parameter reading files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"HSCP name / code lookup — partnerships","text":"","code":"partnerships"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/partnerships.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"HSCP name / code lookup — partnerships","text":"tibble 31 rows 2 variables: partnership_name official name Partnership hscp2018 hscp2018 standard code S370000??","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage File — read_slf","title":"Read a Source Linkage File — read_slf","text":"Read Source Linkage File","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage File — read_slf","text":"","code":"read_slf( year, file_version = c(\"episode\", \"individual\"), dev = FALSE, col_select = NULL, columns = lifecycle::deprecated(), as_data_frame = TRUE, partnerships = NULL, recids = NULL )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage File — read_slf","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). file_version Version file (individual / episode). dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). columns columns longer used, use col_select instead. as_data_frame function return tibble (default) Arrow Table? partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage File — read_slf","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage episode file — read_slf_episode","title":"Read a Source Linkage episode file — read_slf_episode","text":"Read Source Linkage episode file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"read_slf_episode( year, col_select = NULL, partnerships = NULL, recids = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage episode file — read_slf_episode","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. recids Optional specify recid recids select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage episode file — read_slf_episode","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_episode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage episode file — read_slf_episode","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_episode(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\") ) read_slf_episode(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"demographic_cohort\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":null,"dir":"Reference","previous_headings":"","what":"Read a Source Linkage individual file — read_slf_individual","title":"Read a Source Linkage individual file — read_slf_individual","text":"Read Source Linkage individual file","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"read_slf_individual( year, col_select = NULL, partnerships = NULL, as_data_frame = TRUE, dev = FALSE, columns = lifecycle::deprecated() )"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read a Source Linkage individual file — read_slf_individual","text":"year Year file read, can specify multiple years returned one file. converted short FY using format_year(). col_select character vector column names keep, \"select\" argument data.table::fread(), tidy selection specification columns, used dplyr::select(). partnerships Optional specify partnership (hscp2018) partnerships select. as_data_frame function return tibble (default) Arrow Table? dev Whether get file development area (/conf/sourcedev/Source_Linkage_File_Updates). default (FALSE) get production file usual area. columns columns longer used, use col_select instead.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read a Source Linkage individual file — read_slf_individual","text":"requested SLF data tibble Arrow Table.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/read_slf_individual.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read a Source Linkage individual file — read_slf_individual","text":"","code":"if (FALSE) { # \\dontrun{ read_slf_individual(\"1718\", col_select = c(\"anon_chi\", \"dob\", \"hri_scot\") ) read_slf_individual(c(\"1718\", \"1819\"), col_select = c(\"anon_chi\", \"dob\", \"hri_scot\"), as_data_frame = FALSE ) } # }"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":null,"dir":"Reference","previous_headings":"","what":"Recid name / description lookup — recids","title":"Recid name / description lookup — recids","text":"tibble containing names description recids. used recid parameter reading episode files.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recid name / description lookup — recids","text":"","code":"recids"},{"path":"https://public-health-scotland.github.io/slfhelper/reference/recids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Recid name / description lookup — recids","text":"tibble 18 rows 2 variables: recid short-form recid Description description recid","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":null,"dir":"Reference","previous_headings":"","what":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"package provides helper functions working Source Linkage Files (SLFs). functions mainly focused making first steps analysis easier. can read filter files efficiently using minimal code.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/slfhelper/reference/slfhelper-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"slfhelper: Useful functions for working with the Source Linkage Files — slfhelper-package","text":"Maintainer: Megan McNicol megan.mcnicol2@phs.scot Authors: James McMahon james.mcmahon@phs.scot (ORCID) Zihao Li zihao.li@phs.scot (ORCID) Jennifer Thom jennifer.thom@phs.scot contributors: Public Health Scotland phs.source@phs.scot [copyright holder]","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0104","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.4","title":"slfhelper 0.10.4","text":"Bug - Fix build tests New feature - Additional documentation Update README.md Bug - Fix tidyselect feature bug","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0103","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.3","title":"slfhelper 0.10.3","text":"New feature - use tidyselect col_selectin read_slf_episode read_slf_individual.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0102","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.2","title":"slfhelper 0.10.2","text":"Update README.md change episode file cost variable vector force keytime format hms","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0101","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.1","title":"slfhelper 0.10.1","text":"Update README.Rmd Bug - speed get_chi()","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-0100","dir":"Changelog","previous_headings":"","what":"slfhelper 0.10.0","title":"slfhelper 0.10.0","text":"{glue} longer dependency required functionality can provided `stringr::str_glue(). Dependency versions updated latest. get_chi() get_anon_chi() now properly match missing (NA) blank (\"\") values. slfhelper now defaults using .parquet file versions, old versions slfhelper longer work. now dev parameter available using read_slf_* functions allows reading file development environment.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-090","dir":"Changelog","previous_headings":"","what":"slfhelper 0.9.0","title":"slfhelper 0.9.0","text":"{openssl} now required. get_chi() get_anon_chi() now much faster (>100X) use significantly less memory. year parameter now checked early process, invalid year supplied error message much informative.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-082","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.2","title":"slfhelper 0.8.2","text":"ep_file_vars indiv_file_vars updated correct variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-081","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.1","title":"slfhelper 0.8.1","text":"Use cli nicer error messages warning.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-080","dir":"Changelog","previous_headings":"","what":"slfhelper 0.8.0","title":"slfhelper 0.8.0","text":"Add number ‘variable packs’ easily selecting sets variables: demog_vars, ltc_vars, ep_file_bedday_vars ep_file_cost_vars. Add new vignette introducing variable packs.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-071","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.1","title":"slfhelper 0.7.1","text":"Add check server hscdiip access package load. Add recid lookup use recid filtering parameter. using get_anon_chi() now use phsmethods::chi_check (available) warn lot CHI numbers return invalid. Update variable lists new Home Care related variables.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-070","dir":"Changelog","previous_headings":"","what":"slfhelper 0.7.0","title":"slfhelper 0.7.0","text":"Now depends R >= 3.5 ep_file_vars indiv_file_vars updated latest variable names. now also return character vector instead list. read_slf_ now returns tibble.","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-060","dir":"Changelog","previous_headings":"","what":"slfhelper 0.6.0","title":"slfhelper 0.6.0","text":"Fix bug selecting partnerships/recids also selecting multiple years (#13) (#14)","code":""},{"path":"https://public-health-scotland.github.io/slfhelper/news/index.html","id":"slfhelper-053","dir":"Changelog","previous_headings":"","what":"slfhelper 0.5.3","title":"slfhelper 0.5.3","text":"Added NEWS.md file track changes package. Moved use Rmd version readme. Bump dplyr version requirement 1.0.0 enable use across() new things. Add checks year","code":""}]