From 37471f0362538952286901ca8daaec9dcfdd4eb3 Mon Sep 17 00:00:00 2001 From: Moohan Date: Wed, 19 Jul 2023 11:51:55 +0000 Subject: [PATCH] Style code --- R/add_nsu_cohort.R | 3 +-- R/fill_geographies.R | 15 ++++++-------- R/get_source_extract_path.R | 39 ++++++++++++++++++------------------- R/match_on_ltcs.R | 3 +-- R/run_episode_file.R | 3 +-- 5 files changed, 28 insertions(+), 35 deletions(-) diff --git a/R/add_nsu_cohort.R b/R/add_nsu_cohort.R index 1e21de78a..00260bb8e 100644 --- a/R/add_nsu_cohort.R +++ b/R/add_nsu_cohort.R @@ -12,8 +12,7 @@ add_nsu_cohort <- function( data, year, - nsu_cohort = read_file(get_nsu_path(year)) -) { + nsu_cohort = read_file(get_nsu_path(year))) { year_param <- year if (!check_year_valid(year, "NSU")) { diff --git a/R/fill_geographies.R b/R/fill_geographies.R index f0e859169..34b8ca789 100644 --- a/R/fill_geographies.R +++ b/R/fill_geographies.R @@ -13,10 +13,9 @@ fill_geographies <- function( data, slf_pc_lookup = read_file(get_slf_postcode_path()), slf_gpprac_lookup = read_file( - get_slf_gpprac_path(), - col_select = c("gpprac", "cluster", "hbpraccode") - ) -) { + get_slf_gpprac_path(), + col_select = c("gpprac", "cluster", "hbpraccode") + )) { check_variables_exist(data, c( "chi", "postcode", @@ -102,8 +101,7 @@ make_gpprac_lookup <- function(data) { fill_postcode_geogs <- function( data, - slf_pc_lookup -) { + slf_pc_lookup) { filled_postcodes <- dplyr::left_join( data, make_postcode_lookup(data), @@ -151,9 +149,8 @@ fill_postcode_geogs <- function( fill_gpprac_geographies <- function( data, - slf_gpprac_lookup -) { - filled_gpprac <- dplyr::left_join( + slf_gpprac_lookup) { + filled_gpprac <- dplyr::left_join( data, make_gpprac_lookup(data), by = "chi" diff --git a/R/get_source_extract_path.R b/R/get_source_extract_path.R index 3bcb476d6..c74d4381c 100644 --- a/R/get_source_extract_path.R +++ b/R/get_source_extract_path.R @@ -13,26 +13,25 @@ get_source_extract_path <- function( year, type = c( - "Acute", - "AE", - "AT", - "CH", - "Client", - "CMH", - "DD", - "Deaths", - "DN", - "GPOoH", - "HC", - "Homelessness", - "Maternity", - "MH", - "Outpatients", - "PIS", - "SDS" - ), - ... -) { + "Acute", + "AE", + "AT", + "CH", + "Client", + "CMH", + "DD", + "Deaths", + "DN", + "GPOoH", + "HC", + "Homelessness", + "Maternity", + "MH", + "Outpatients", + "PIS", + "SDS" + ), + ...) { type <- match.arg(type) if (!check_year_valid(year, type)) { diff --git a/R/match_on_ltcs.R b/R/match_on_ltcs.R index d7b65ce2a..e1e423d25 100644 --- a/R/match_on_ltcs.R +++ b/R/match_on_ltcs.R @@ -11,8 +11,7 @@ match_on_ltcs <- function( data, year, - ltc_data = read_file(get_ltcs_path(year)) -) { + ltc_data = read_file(get_ltcs_path(year))) { # Match on LTC lookup matched <- dplyr::left_join( data, diff --git a/R/run_episode_file.R b/R/run_episode_file.R index 6933eb8df..9e1baa6eb 100644 --- a/R/run_episode_file.R +++ b/R/run_episode_file.R @@ -390,8 +390,7 @@ join_cohort_lookups <- function( service_use_cohort = read_file( get_service_use_cohorts_path(year, update), col_select = c("chi", "service_use_cohort") - ) -) { + )) { join_cohort_lookups <- data %>% dplyr::left_join( demographic_cohort,