From 21aa0468fe09c23db270af4f1eec7ebf64c160b4 Mon Sep 17 00:00:00 2001 From: Milan Wiedemann Date: Mon, 27 Jan 2025 10:47:46 +0100 Subject: [PATCH] Run `styler::style_file("analysis/create_tables.R")` --- analysis/create_tables.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/analysis/create_tables.R b/analysis/create_tables.R index 97aecc0..25df867 100644 --- a/analysis/create_tables.R +++ b/analysis/create_tables.R @@ -8,14 +8,14 @@ library(purrr) df <- read_csv(here("output", "population", "pf_table1.csv.gz")) df_demographics <- df %>% - select(sex, age_band, region, imd, ethnicity) + select(sex, age_band, region, imd, ethnicity) # map_dfr maps function to each elevent and combines result in single df df_demographics_counts <- map_dfr( - # Column names sex, age_band, region, imd, ethnicity are inputs (.x) + # Column names sex, age_band, region, imd, ethnicity are inputs (.x) names(df_demographics), ~ df_demographics %>% - # Group by each column + # Group by each column group_by(across(all_of(.x))) %>% # summarises df with a new column which counts occurences (n) summarise(n = n()) %>% @@ -68,4 +68,4 @@ readr::write_csv( # gt_table -#output/population/pf_population.csv.gz \ No newline at end of file +# output/population/pf_population.csv.gz