-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Viv3ckj/update viz #25
Changes from all commits
a01fa78
44bcf86
425928f
a0f1b2a
86cf746
e4db892
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,34 @@ df_measures <- tidy_measures( | |
pf_measures_name_mapping = pf_measures_name_mapping, | ||
pf_measures_groupby_dict = pf_measures_groupby_dict | ||
) | ||
|
||
df_measures$ethnicity <- factor( | ||
df_measures$ethnicity, | ||
levels = c("White", "Mixed", "Asian or Asian British", | ||
"Black or Black British", "Chinese or Other Ethnic Groups", | ||
"Missing"), | ||
ordered = TRUE | ||
) | ||
|
||
df_measures$age_band <- factor( | ||
df_measures$age_band, | ||
levels = c("0-19", "20-39", "40-59", | ||
"60-79", "80+", | ||
"Missing"), | ||
ordered = TRUE | ||
) | ||
|
||
df_measures$region <- factor( | ||
df_measures$region, | ||
levels = c("East", "East Midlands", "London", | ||
"North East", "North West", "South East", | ||
"South West", "West Midlands", "Yorkshire and The Humber", | ||
"Missing"), | ||
ordered = TRUE | ||
) | ||
|
||
df_measures <- df_measures %>% | ||
mutate(sex = factor(sex, levels = c("female", "male"), labels = c("Female", "Male"))) | ||
``` | ||
|
||
# Background | ||
|
@@ -93,7 +121,7 @@ Links to the codelist for each analysis can be found beneath the relevant sectio | |
|
||
### Total population | ||
|
||
```{r, message=FALSE, warning=FALSE, fig.height=4, fig.width=4} | ||
```{r, message=FALSE, warning=FALSE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should keep this? it makes sure all the panels are roughly the same size? or what was your reason for removing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was an issue with the titles and axes being cropped out |
||
# Select measures and breakdown | ||
df_measures_selected <- df_measures %>% | ||
filter(measure_desc == "clinical_service") %>% | ||
|
@@ -108,6 +136,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = FALSE, | ||
facet_var = NULL, | ||
title = "Number of consultations for each clinical service per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -127,7 +157,9 @@ plot_measures( | |
colour_var = age_band, | ||
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical service by age band per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -148,6 +180,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical service by sex per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -168,6 +202,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical service by IMD per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -188,6 +224,8 @@ plot_measures( | |
guide_nrow = 2, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical service by region per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -210,6 +248,8 @@ plot_measures( | |
guide_nrow = 2, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical service by ethnicity per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -220,7 +260,7 @@ Here we show the number of consultations for each of the Pharmacy First Clinical | |
|
||
### Total population | ||
|
||
```{r, message=FALSE, warning=FALSE, fig.height=4, fig.width=4} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment above |
||
```{r, message=FALSE, warning=FALSE} | ||
# Select measures and breakdown | ||
df_measures_selected <- df_measures %>% | ||
filter(measure_desc == "clinical_condition") %>% | ||
|
@@ -234,6 +274,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = FALSE, | ||
facet_var = NULL, | ||
title = "Number of consultations for each clinical condition per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -253,7 +295,9 @@ plot_measures( | |
colour_var = age_band, | ||
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical condition by age band per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -274,6 +318,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical condition by sex per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -294,6 +340,8 @@ plot_measures( | |
guide_nrow = 1, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical condition by IMD per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
|
@@ -314,12 +362,14 @@ plot_measures( | |
guide_nrow = 2, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical condition by region per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` | ||
|
||
### Clinical Conditions by ethnicity | ||
|
||
```{r, message=FALSE, warning=FALSE} | ||
```{r, message=FALSE, warning=FALSE, fig.height=15, fig.width=8} | ||
viv3ckj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Select measures and breakdown | ||
df_measures_selected <- df_measures %>% | ||
|
@@ -335,5 +385,7 @@ plot_measures( | |
guide_nrow = 2, | ||
facet_wrap = TRUE, | ||
facet_var = measure, | ||
title = "Number of consultations for each clinical condition by ethnicity per month", | ||
y_label = "Number of codes for consultations", | ||
) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does what we want, but it would be could do this as one call using mutate. at some later point we should integrate this into the
tidy_measures()
function, for now I think it's ok if we do this outside of the function.