(Updated 2021-09-01) Our pediatric chapter’s advocacy committee asked the chapter members what their priorities are for advocacy issues. We gave them a list of topics to rate as 1-10 and I needed to calculate the mean score then rank them. This is probably doable as a pivot table within the spreadsheet software, but why pivot table when I can practice some data manipulation skills?
First load tidyverse package and advocacy dataset.
library(tidyverse)
## ── Attaching packages ───────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ purrr 0.3.4
## ✓ tibble 3.0.3 ✓ dplyr 1.0.2
## ✓ tidyr 1.1.2 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ──────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
advo <- read_csv("../datasets/advocacy_survey.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## Timestamp = col_character(),
## `What other topics would you like us to focus on, if any?` = col_character(),
## `Other comments, suggestions:` = col_character()
## )
## See spec(...) for full column specifications.
advo
## # A tibble: 19 x 21
## Timestamp `HAAP Community… `Medical Home a… `Strengthening … `Strengthening …
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 5/16/202… 4 4 4 9
## 2 5/16/202… 9 8 8 7
## 3 5/16/202… 9 10 8 1
## 4 5/16/202… 7 10 6 7
## 5 5/17/202… 5 7 5 4
## 6 5/18/202… 3 10 8 8
## 7 5/23/202… 8 7 9 8
## 8 5/23/202… 7 10 9 7
## 9 5/23/202… 8 10 8 8
## 10 5/23/202… 10 10 10 8
## 11 5/23/202… 2 10 7 5
## 12 5/23/202… 8 8 9 8
## 13 5/24/202… 7 4 9 4
## 14 5/24/202… 5 7 10 8
## 15 5/24/202… 1 1 10 1
## 16 5/26/202… NA 10 NA NA
## 17 5/27/202… 8 9 10 10
## 18 5/27/202… 3 3 8 6
## 19 5/27/202… 8 8 9 6
## # … with 16 more variables: `Strengthening regulations on daycares to reduce
## # deaths of children in unsafe childcare conditions` <dbl>, `Tobacco/Vaping
## # prevention and control` <dbl>, `Support for children and teenagers who come
## # into contact with the criminal legal system` <dbl>, `Food insecurity /
## # healthy eating` <dbl>, `Access to health care` <dbl>, `Houselessness and
## # poverty alleviation` <dbl>, `Combating racism, prejudice, and related
## # trauma` <dbl>, `Access to timely and appropriate mental health
## # services` <dbl>, `Increase visibility of HAAP as a resource for children
## # and families (e.g. social media, letters to the editor, local news,
## # etc)` <dbl>, `Health literacy` <dbl>, `Language access for patients /
## # families with limited English proficiency` <dbl>, `Vaccines (recent issues
## # have included pharmacy vaccination, anti-vaxxers, school exemptions,
## # etc.)` <dbl>, `Expanding school-based health and/or behavioral
## # services` <dbl>, `Climate justice and mitigation` <dbl>, `What other topics
## # would you like us to focus on, if any?` <chr>, `Other comments,
## # suggestions:` <chr>
I got rid of the timestamp and the free text questions.
advo <- advo[-c(1,20,21)]
Then I had to convert the wide data into long data, calculate the mean responses, and sort them by mean.
advo %>%
pivot_longer(cols = names(advo),
names_to = "topic",
values_to = "score") %>%
group_by(topic) %>%
summarize(responses = sum(!is.na(score)), mscore = mean(score, na.rm = T)) %>%
arrange(-mscore)
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 18 x 3
## topic responses mscore
## <chr> <int> <dbl>
## 1 Access to timely and appropriate mental health services 19 8.74
## 2 Vaccines (recent issues have included pharmacy vaccination,… 18 8.61
## 3 Strengthening Early Intervention services 18 8.17
## 4 Medical Home advocacy with payers, government 19 7.68
## 5 Expanding school-based health and/or behavioral services 17 7.53
## 6 Tobacco/Vaping prevention and control 18 7.5
## 7 Food insecurity / healthy eating 19 7.47
## 8 Access to health care 19 7.32
## 9 Health literacy 19 6.89
## 10 Support for children and teenagers who come into contact wi… 18 6.89
## 11 Increase visibility of HAAP as a resource for children and … 18 6.83
## 12 Language access for patients / families with limited Englis… 19 6.58
## 13 Combating racism, prejudice, and related trauma 19 6.42
## 14 Houselessness and poverty alleviation 18 6.39
## 15 Strengthening Child Welfare Services 18 6.39
## 16 HAAP Community Engagement (e.g. doing educational sessions,… 18 6.22
## 17 Strengthening regulations on daycares to reduce deaths of c… 18 5.72
## 18 Climate justice and mitigation 18 5.17