1) Import and clean data
Load packages, import Excel file, skip first line, rename data file,
convert to tibble, clean up variable names. This gives us a data frame
with 1714 observations of 73 variable
library(tidyverse)
library(lubridate)
library(janitor)
library(readxl)
library(rmarkdown)
library(readxl)
library(scales)
library(gt)
library(gtsummary)
library(ggplot2)
library(ggmap)
library(plotly)
library(tidygeocoder)
library(zipcodeR)
ep_data <- read_excel("RVTICN_EP_data.xlsx",
skip = 1)
ep_data <- ep_data|>
clean_names()
ep_data
## # A tibble: 1,714 × 74
## session created modified ended expired ep_what ep_what_other teacher
## <chr> <chr> <chr> <chr> <lgl> <chr> <lgl> <dbl>
## 1 <NA> 2023-0… <NA> <NA> NA <NA> NA NA
## 2 okSk8ugA7x7LS_z… 2023-0… 2023-02… <NA> NA 5, 10 NA NA
## 3 <NA> 2023-0… <NA> <NA> NA <NA> NA NA
## 4 zanyTortoiseXXX… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 5 darkEelXXXn1bps… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 6 <NA> 2023-0… 2023-01… <NA> NA <NA> NA NA
## 7 jwfpui27QyMPIDi… 2023-0… <NA> <NA> NA <NA> NA NA
## 8 UfKwkbNB1UQO_Zc… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 9 4XFTbS1lynxtwmE… 2023-0… <NA> <NA> NA <NA> NA NA
## 10 -E0cUzh4UJQpwKl… 2023-0… <NA> <NA> NA <NA> NA NA
## # ℹ 1,704 more rows
## # ℹ 66 more variables: teacher_role <dbl>, teacher_role_other <chr>,
## # teacher_center <dbl>, teacher_center_other <chr>, teacher_age <chr>,
## # teacher_suspended <dbl>, teacher_suspended_times <dbl>,
## # reasons_suspended <chr>, teacher_suspended_steps <chr>,
## # teacher_suspended_steps_other <lgl>, teacher_expelled <dbl>,
## # teacher_times_expelled <dbl>, reasons_expelled <chr>, …
2) Removing missing data
Drop rows with data missing in the session or modified column. This
gives us a data frame with 94 observations of 73 variables
ep_data <-ep_data %>%
drop_na(session, modified)
ep_data
## # A tibble: 94 × 74
## session created modified ended expired ep_what ep_what_other teacher
## <chr> <chr> <chr> <chr> <lgl> <chr> <lgl> <dbl>
## 1 okSk8ugA7x7LS_z… 2023-0… 2023-02… <NA> NA 5, 10 NA NA
## 2 zanyTortoiseXXX… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 3 darkEelXXXn1bps… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 4 UfKwkbNB1UQO_Zc… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 5 Q13gEgNnVlr2fuN… 2023-0… 2023-02… <NA> NA 13.0 NA 1
## 6 whkMSapD6z3QnFn… 2023-0… 2023-02… 2023… NA <NA> NA 1
## 7 0a_xbAPNdpM-Kxt… 2023-0… 2023-02… <NA> NA <NA> NA NA
## 8 8HbVA9v6BS98pWO… 2023-0… 2023-03… <NA> NA <NA> NA NA
## 9 0DmnsxoDUAoU2H2… 2023-0… 2023-03… <NA> NA <NA> NA NA
## 10 LyA6W1isX5jE8Ub… 2023-0… 2023-03… <NA> NA <NA> NA NA
## # ℹ 84 more rows
## # ℹ 66 more variables: teacher_role <dbl>, teacher_role_other <chr>,
## # teacher_center <dbl>, teacher_center_other <chr>, teacher_age <chr>,
## # teacher_suspended <dbl>, teacher_suspended_times <dbl>,
## # reasons_suspended <chr>, teacher_suspended_steps <chr>,
## # teacher_suspended_steps_other <lgl>, teacher_expelled <dbl>,
## # teacher_times_expelled <dbl>, reasons_expelled <chr>, …
3 Data Wrangling
Create factor variables with plan English responses, re-level factors
into normal order. This gives us a data frame with 94 observations of
119 variables
ep_data <- ep_data %>%
mutate(ep_role = case_when(teacher == 1 ~ "Teacher",
ep_child == 1 ~ "Caregiver",
ep_self == 1 ~ "Self",
TRUE ~ "No role specified"))|>
mutate(zip = case_when(zip_teach >= 1 ~ zip_teach,
zip_child >= 1 ~ zip_child,
zip_adult >= 1 ~ zip_adult))|>
mutate(ep_child_f = case_when(ep_child == 1 ~ "Yes",
ep_child == 2 ~ "No",
ep_child == 3 ~ "Unsure"))|>
mutate(ep_child_f=factor(ep_child_f)) |>
mutate(ep_child_f = fct_relevel( ep_child_f, 'Yes','No','Unsure')) |>
mutate(relationship_f = case_when(relationship == 1 ~ "Parent",
relationship == 3 ~ "Foster Parent",
relationship == 7 ~ "Aunt or Uncle",
relationship == 8 & relationship_other == "TDT, Intensive in home" |
relationship == 8 & relationship_other == "family member and social worker" ~ "Mental Health Provider"))|>
mutate(relationship_f=factor(relationship_f)) |>
mutate(relationship_f = fct_relevel( relationship_f, 'Parent','Foster Parent','Aunt or Uncle','Mental Health Provider')) |>
mutate(child_expelled_times_f = case_when(child_expelled_times == 1 ~ "Once",
child_expelled_times == 2 ~ "Twice",
child_expelled_times == 3 ~ "Three Times",
child_expelled_times == 4 ~ "More than Three Times"))|>
mutate(child_expelled_times_f = factor(child_expelled_times_f)) |>
mutate(child_expelled_times_f = fct_relevel(child_expelled_times_f, 'Once','Twice','Three Times', 'More than Three Times')) |>
mutate(child_expelled_age_f = case_when(child_expelled_age == 1 ~ "0 - 2 Years",
child_expelled_age == 2 ~ "3 - 5 Years",
child_expelled_age == 3 ~ "6 - 12 Years",
child_expelled_age == 4 ~ "Over 12 Years"))|>
mutate(child_expelled_age_f = factor(child_expelled_age_f)) |>
mutate(child_expelled_age_f = fct_relevel(child_expelled_age_f, '0 - 2 Years','3 - 5 Years','6 - 12 Years', 'Over 12 Years')) |>
mutate(child_expelled_steps_1 = case_when(str_detect(child_expelled_steps, "1") ~ 1))|>
mutate(child_expelled_steps_2 = case_when(str_detect(child_expelled_steps, "2") ~ 1))|>
mutate(child_expelled_steps_3 = case_when(str_detect(child_expelled_steps, "3") ~ 1))|>
mutate(child_expelled_steps_4 = case_when(str_detect(child_expelled_steps, "4") ~ 1))|>
mutate(child_expelled_steps_5 = case_when(str_detect(child_expelled_steps, "5") ~ 1))|>
mutate(child_expelled_steps_6 = case_when(str_detect(child_expelled_steps, "6") ~ 1))|>
mutate(rate_relationship_expelled_child_f = case_when(rate_relationship_expelled_child == 1 ~ "Very Good",
rate_relationship_expelled_child == 2 ~ "Good",
rate_relationship_expelled_child == 3 ~ "Neutral",
rate_relationship_expelled_child == 4 ~ "Bad",
rate_relationship_expelled_child == 5 ~ "Very Bad"))|>
mutate(rate_relationship_expelled_child_f = factor(rate_relationship_expelled_child_f)) |>
mutate(rate_relationship_expelled_child_f = fct_relevel(rate_relationship_expelled_child_f, 'Very Good','Good','Neutral', 'Bad', 'Very Bad')) |>
mutate(child_suspended_f = case_when(child_suspended == 1 ~ "Yes",
child_suspended == 2 ~ "No",
child_suspended == 3 ~ "Unsure"))|>
mutate(child_suspended_f=factor(child_suspended_f)) |>
mutate(child_suspended_f = fct_relevel( child_suspended_f, 'Yes','No','Unsure')) |>
mutate(child_suspended_times_f = case_when(child_suspended_times == 1 ~ "Once",
child_suspended_times == 2 ~ "Twice",
child_suspended_times == 3 ~ "Three Times",
child_suspended_times == 4 ~ "More than Three Times"))|>
mutate(child_suspended_times_f = factor(child_suspended_times_f)) |>
mutate(child_suspended_times_f = fct_relevel(child_suspended_times_f, 'Once','Twice','Three Times', 'More than Three Times')) |>
mutate(child_suspended_age_f = case_when(child_suspended_age == 1 ~ "0 - 2 Years",
child_suspended_age == 2 ~ "3 - 5 Years",
child_suspended_age == 3 ~ "6 - 12 Years",
child_suspended_age == 4 ~ "Over 12 Years"))|>
mutate(child_suspended_age_f = factor(child_suspended_age_f)) |>
mutate(child_suspended_age_f = fct_relevel(child_suspended_age_f, '0 - 2 Years','3 - 5 Years','6 - 12 Years', 'Over 12 Years')) |>
mutate(child_suspended_steps_1 = case_when(str_detect(child_suspended_steps, "1") ~ 1))|>
mutate(child_suspended_steps_2 = case_when(str_detect(child_suspended_steps, "2") ~ 1))|>
mutate(child_suspended_steps_3 = case_when(str_detect(child_suspended_steps, "3") ~ 1))|>
mutate(child_suspended_steps_4 = case_when(str_detect(child_suspended_steps, "4") ~ 1))|>
mutate(child_suspended_steps_5 = case_when(str_detect(child_suspended_steps, "5") ~ 1))|>
mutate(child_suspended_steps_6 = case_when(str_detect(child_suspended_steps, "6") ~ 1))|>
mutate(rate_relationship_suspended_child_f = case_when(rate_relationship_suspended_child == 1 ~ "Very Good",
rate_relationship_suspended_child == 2 ~ "Good",
rate_relationship_suspended_child == 3 ~ "Neutral",
rate_relationship_suspended_child == 4 ~ "Bad",
rate_relationship_suspended_child == 5 ~ "Very Bad"))|>
mutate(rate_relationship_suspended_child_f = factor(rate_relationship_suspended_child_f)) |>
mutate(rate_relationship_suspended_child_f = fct_relevel(rate_relationship_suspended_child_f, 'Very Good','Good','Neutral', 'Bad', 'Very Bad')) |>
mutate(ep_effects_1 = case_when(str_detect(ep_effects, "1") ~ 1))|>
mutate(ep_effects_2 = case_when(str_detect(ep_effects, "2") ~ 1))|>
mutate(ep_effects_3 = case_when(str_detect(ep_effects, "3") ~ 1))|>
mutate(ep_effects_4 = case_when(str_detect(ep_effects, "4") ~ 1))|>
mutate(child_attributes_1 = case_when(str_detect(child_attributes, "1") ~ 1))|>
mutate(child_attributes_2 = case_when(str_detect(child_attributes, "2") ~ 1))|>
mutate(child_attributes_3 = case_when(str_detect(child_attributes, "3") ~ 1))|>
mutate(child_attributes_4 = case_when(str_detect(child_attributes, "4") ~ 1))|>
mutate(child_attributes_5 = case_when(str_detect(child_attributes, "5") ~ 1))|>
mutate(child_attributes_6 = case_when(str_detect(child_attributes, "6") ~ 1))|>
mutate(child_attributes_7 = case_when(str_detect(child_attributes, "7") ~ 1))|>
mutate(child_race_1 = case_when(str_detect(child_race, "1") ~ 1))|>
mutate(child_race_2 = case_when(str_detect(child_race, "2") ~ 1))|>
mutate(child_race_3 = case_when(str_detect(child_race, "3") ~ 1))|>
mutate(child_race_4 = case_when(str_detect(child_race, "4") ~ 1))|>
mutate(child_race_5 = case_when(str_detect(child_race, "5") ~ 1))|>
mutate(child_race_6 = case_when(str_detect(child_race, "6") ~ 1))|>
mutate(child_language_f = case_when(child_language == 1 ~ "English",
child_language == 2 ~ "Spanish",
child_language == 3 ~ "Child is non-verbal",
child_language == 4 ~ "Other"))|>
mutate(child_language_f = factor(child_language_f)) |>
mutate(child_language_f = fct_relevel(child_language_f, 'English','Spanish','Child is non-verbal', 'Other'))|>
mutate(child_foster = case_when(relationship == 3|child_attributes_3 == 1 ~ 1,
TRUE ~ 0))|>
mutate(child_foster_f = case_when(child_foster == 1 ~ "Child is or has been in foster care",
child_foster == 0 ~ "Child is not and has not been in foster care"))|>
mutate(child_disability_f = case_when(child_attributes_1 ==1 | child_attributes_2 == 1 ~ "Child has a disability",
TRUE ~ "Child does not have a disability"))|>
mutate(child_trauma_f = case_when(child_attributes_4 == 1 ~ "Child has experienced trauma",
TRUE ~ "Child has not experienced trauma"))|>
mutate(child_childcare_subsidy_f = case_when(child_attributes_5 == 1 ~ "Child has recieved childcare subsidy",
TRUE ~ "Child has not recieved childcare subsidy"))|>
mutate(child_therapy_f = case_when(child_attributes_6 == 1 ~ "Child has recieved therapy",
TRUE ~ "Child has not recieved therapy"))|>
mutate(child_funding_f = case_when(child_attributes_7 == 1 ~ "Child has recieved funding through FAPT, SNAP, WIC or Medicaid",
TRUE ~ "Child has not recieved funding through FAPT, SNAP, WIC, or Medicaid"))|>
mutate(child_race_f = case_when(child_race == "1.0" ~ "Black or African-American",
child_race == "5.0" ~ "White or Caucasian",
child_race == "1, 5" ~ "Multiracial White and Black"))|>
mutate(child_race_2factor = case_when(child_race == "1.0" ~ "Black or African-American",
child_race == "5.0" ~ "White or Caucasian",
child_race == "1, 5" ~ "Black or African-American"))
head(ep_data)
## # A tibble: 6 × 124
## session created modified ended expired ep_what ep_what_other teacher
## <chr> <chr> <chr> <chr> <lgl> <chr> <lgl> <dbl>
## 1 okSk8ugA7x7LS_zx… 2023-0… 2023-02… <NA> NA 5, 10 NA NA
## 2 zanyTortoiseXXXf… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 3 darkEelXXXn1bpsS… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 4 UfKwkbNB1UQO_Zcp… 2023-0… 2023-01… <NA> NA <NA> NA NA
## 5 Q13gEgNnVlr2fuNO… 2023-0… 2023-02… <NA> NA 13.0 NA 1
## 6 whkMSapD6z3QnFn0… 2023-0… 2023-02… 2023… NA <NA> NA 1
## # ℹ 116 more variables: teacher_role <dbl>, teacher_role_other <chr>,
## # teacher_center <dbl>, teacher_center_other <chr>, teacher_age <chr>,
## # teacher_suspended <dbl>, teacher_suspended_times <dbl>,
## # reasons_suspended <chr>, teacher_suspended_steps <chr>,
## # teacher_suspended_steps_other <lgl>, teacher_expelled <dbl>,
## # teacher_times_expelled <dbl>, reasons_expelled <chr>,
## # teacher_expelled_steps <chr>, teacher_expelled_steps_other <lgl>, …
4 Outcomes for Children in Foster Care
# table
sum_child_suspended_foster <- ep_data |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_foster_f)|>
tbl_summary(
by = child_foster_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Foster Care Status**")
sum_child_suspended_foster
| Suspensions by Foster Care Status |
Child is not and has not been in foster care, N = 5 |
Child is or has been in foster care, N = 10 |
| How many times has your child been suspended? |
|
|
| Once |
2 (100%) |
0 (0%) |
| Twice |
1 (25%) |
3 (75%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
2 (25%) |
6 (75%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_foster_f)
sum_child_suspended_foster_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_foster_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Foster Care Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_foster_g

# table
sum_child_expelled_foster <- ep_data |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_foster_f)|>
tbl_summary(
by = child_foster_f,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Foster Care Status**")
sum_child_expelled_foster
| Expulsions by Foster Care Status |
Child is not and has not been in foster care, N = 5 |
Child is or has been in foster care, N = 9 |
| How many times has your child been expelled? |
|
|
| Once |
2 (33%) |
4 (67%) |
| Twice |
2 (33%) |
4 (67%) |
| More than Three Times |
1 (50%) |
1 (50%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_foster_f)
sum_child_expelled_foster_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_foster_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Expelled") + ylab("Count") +
ggtitle("Expulsions by Foster Care Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_foster_g

5 Outcomes for Children with disabilities
# table
sum_child_suspended_disability <- ep_data |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_disability_f)|>
tbl_summary(
by = child_disability_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Disability Status**")
sum_child_suspended_disability
| Suspensions by Disability Status |
Child does not have a disability, N = 6 |
Child has a disability, N = 9 |
| How many times has your child been suspended? |
|
|
| Once |
1 (50%) |
1 (50%) |
| Twice |
4 (100%) |
0 (0%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
1 (13%) |
7 (88%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_suspended_times_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_expelled_times_f, child_disability_f, child_foster_f, child_attributes_1, child_attributes_2)
sum_child_suspended_disability_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_disability_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Disability Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_disability_g

# table
sum_child_expelled_disability <- ep_data |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_disability_f)|>
tbl_summary(
by = child_disability_f,
label = child_expelled_times_f ~ "How many times has your child been Expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Disability Status**")
sum_child_expelled_disability
| Expulsions by Disability Status |
Child does not have a disability, N = 4 |
Child has a disability, N = 10 |
| How many times has your child been Expelled? |
|
|
| Once |
2 (33%) |
4 (67%) |
| Twice |
1 (17%) |
5 (83%) |
| More than Three Times |
1 (50%) |
1 (50%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_expelled_times_f, child_disability_f, child_foster_f, child_attributes_1, child_attributes_2)
sum_child_expelled_disability_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_disability_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Expelled") + ylab("Count") +
ggtitle("Expulsions by Disability Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_disability_g

6 Outcomes for Children with a history of trauma
# table
sum_child_suspended_trauma <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_trauma_f)|>
tbl_summary(
by = child_trauma_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Trauma History Status**")
sum_child_suspended_trauma
| Suspensions by Trauma History Status |
Child has experienced trauma, N = 11 |
Child has not experienced trauma, N = 4 |
| How many times has your child been suspended? |
|
|
| Once |
1 (50%) |
1 (50%) |
| Twice |
3 (75%) |
1 (25%) |
| Three Times |
1 (100%) |
0 (0%) |
| More than Three Times |
6 (75%) |
2 (25%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_suspended_times_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_trauma_f)
sum_child_suspended_trauma_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_trauma_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Trauma History Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_trauma_g

# table
sum_child_expelled_trauma <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_trauma_f)|>
tbl_summary(
by = child_trauma_f,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Trauma History Status**")
sum_child_expelled_trauma
| Expulsions by Trauma History Status |
Child has experienced trauma, N = 11 |
Child has not experienced trauma, N = 3 |
| How many times has your child been expelled? |
|
|
| Once |
4 (67%) |
2 (33%) |
| Twice |
5 (83%) |
1 (17%) |
| More than Three Times |
2 (100%) |
0 (0%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_expelled_times_f, child_trauma_f)
sum_child_expelled_trauma_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_trauma_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Trauma History Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_trauma_g

7 Outcomes for Children who have recieved therapy
# table
sum_child_suspended_therapy <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_therapy_f)|>
tbl_summary(
by = child_therapy_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Therapy Status**")
sum_child_suspended_therapy
| Suspensions by Therapy Status |
Child has not recieved therapy, N = 3 |
Child has recieved therapy, N = 12 |
| How many times has your child been suspended? |
|
|
| Once |
1 (50%) |
1 (50%) |
| Twice |
1 (25%) |
3 (75%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
1 (13%) |
7 (88%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_suspended_times_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_therapy_f)
sum_child_suspended_therapy_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_therapy_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Therapy Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_therapy_g

# table
sum_child_expelled_therapy <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_therapy_f)|>
tbl_summary(
by = child_therapy_f,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Therapy Status**")
sum_child_expelled_therapy
| Expulsions by Therapy Status |
Child has not recieved therapy, N = 4 |
Child has recieved therapy, N = 10 |
| How many times has your child been expelled? |
|
|
| Once |
1 (17%) |
5 (83%) |
| Twice |
2 (33%) |
4 (67%) |
| More than Three Times |
1 (50%) |
1 (50%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_expelled_times_f, child_therapy_f)
sum_child_expelled_therapy_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_therapy_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Expulsions by Therapy Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_therapy_g

8 Outcomes for Children who have recieved childcare subsidy
# table
sum_child_suspended_childcare_subsidy <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_childcare_subsidy_f)|>
tbl_summary(
by = child_childcare_subsidy_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Childcare Subsidy Status**")
sum_child_suspended_childcare_subsidy
| Suspensions by Childcare Subsidy Status |
Child has not recieved childcare subsidy, N = 8 |
Child has recieved childcare subsidy, N = 7 |
| How many times has your child been suspended? |
|
|
| Once |
1 (50%) |
1 (50%) |
| Twice |
2 (50%) |
2 (50%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
5 (63%) |
3 (38%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_suspended_times_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_childcare_subsidy_f)
sum_child_suspended_childcare_subsidy_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_childcare_subsidy_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Childcare Subsidy Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_childcare_subsidy_g

# table
sum_child_expelled_childcare_subsidy <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_childcare_subsidy_f)|>
tbl_summary(
by = child_childcare_subsidy_f,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Childcare SUbsidy Status**")
sum_child_expelled_childcare_subsidy
| Expulsions by Childcare SUbsidy Status |
Child has not recieved childcare subsidy, N = 7 |
Child has recieved childcare subsidy, N = 7 |
| How many times has your child been expelled? |
|
|
| Once |
3 (50%) |
3 (50%) |
| Twice |
4 (67%) |
2 (33%) |
| More than Three Times |
0 (0%) |
2 (100%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_expelled_times_f, child_childcare_subsidy_f)
sum_child_expelled_childcare_subsidy_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_childcare_subsidy_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Expulsions by Childcare Subsidy Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_childcare_subsidy_g

9 Outcomes for Children who have recieved funding from FAPT, SNAP,
WIC, or Medicaid
# table
sum_child_suspended_funding <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_funding_f)|>
tbl_summary(
by = child_funding_f,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Childcare Subsidy Status**")
sum_child_suspended_funding
| Suspensions by Childcare Subsidy Status |
Child has not recieved funding through FAPT, SNAP, WIC, or Medicaid, N = 6 |
Child has recieved funding through FAPT, SNAP, WIC or Medicaid, N = 9 |
| How many times has your child been suspended? |
|
|
| Once |
2 (100%) |
0 (0%) |
| Twice |
1 (25%) |
3 (75%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
3 (38%) |
5 (63%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_funding_f)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_funding_f)
sum_child_suspended_funding_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_funding_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Funding Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_funding_g

# table
sum_child_expelled_funding <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_funding_f)|>
tbl_summary(
by = child_funding_f,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Funding Status**")
sum_child_expelled_funding
| Expulsions by Funding Status |
Child has not recieved funding through FAPT, SNAP, WIC, or Medicaid, N = 4 |
Child has recieved funding through FAPT, SNAP, WIC or Medicaid, N = 10 |
| How many times has your child been expelled? |
|
|
| Once |
1 (17%) |
5 (83%) |
| Twice |
2 (33%) |
4 (67%) |
| More than Three Times |
1 (50%) |
1 (50%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_expelled_times_f, child_funding_f)
sum_child_expelled_funding_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_funding_f)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Expulsions by Funding Status") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_funding_g

10 Outcomes for Children by Race
# table
sum_child_suspended_race_f <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_suspended_times_f)|>
select(child_suspended_times_f, child_race_2factor)|>
tbl_summary(
by = child_race_2factor,
label = child_suspended_times_f ~ "How many times has your child been suspended?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Suspensions by Race**")
sum_child_suspended_race_f
| Suspensions by Race |
Black or African-American, N = 4 |
White or Caucasian, N = 11 |
| How many times has your child been suspended? |
|
|
| Once |
1 (50%) |
1 (50%) |
| Twice |
1 (25%) |
3 (75%) |
| Three Times |
0 (0%) |
1 (100%) |
| More than Three Times |
2 (25%) |
6 (75%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_race_2factor)|>
filter(ep_child == 1)|>
select(child_suspended_times_f, child_race_2factor)
sum_child_suspended_race_f_g <- ggplot(data = ep_data_child,
aes(x = child_suspended_times_f, fill = child_race_2factor)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Suspensions by Race") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_suspended_race_f_g

# table
sum_child_expelled_race_f <- ep_data |>
filter(ep_child == 1) |>
drop_na(child_expelled_times_f)|>
select(child_expelled_times_f, child_race_2factor)|>
tbl_summary(
by = child_race_2factor,
label = child_expelled_times_f ~ "How many times has your child been expelled?",
statistic = list(all_categorical() ~ "{n} ({p}%)"),
percent = "row")|>
modify_header(label ~ "**Expulsions by Race**")
sum_child_expelled_race_f
| Expulsions by Race |
Black or African-American, N = 3 |
White or Caucasian, N = 11 |
| How many times has your child been expelled? |
|
|
| Once |
2 (33%) |
4 (67%) |
| Twice |
1 (17%) |
5 (83%) |
| More than Three Times |
0 (0%) |
2 (100%) |
# graph
ep_data_child <- ep_data|>
drop_na(child_expelled_times_f)|>
filter(ep_child == 1)|>
select(child_expelled_times_f, child_race_2factor)
sum_child_expelled_race_f_g <- ggplot(data = ep_data_child,
aes(x = child_expelled_times_f, fill = child_race_2factor)) +
geom_bar(colour="black", width=.8,stat="count", position = position_dodge(preserve = 'single')) +
xlab("Times Suspended") + ylab("Count") +
ggtitle("Expulsions by Race") +
theme(legend.title = element_blank()) +
scale_x_discrete(labels = label_wrap(10))
sum_child_expelled_race_f_g

12 Write Data and Tables to Exl Files
library(writexl)
# Write Tables to EXL
sum_child_suspended_foster <- sum_child_suspended_foster|>
as_tibble()
sum_child_expelled_foster<- sum_child_expelled_foster|>
as_tibble()
sum_child_suspended_disability <- sum_child_suspended_disability|>
as_tibble()
sum_child_expelled_disability <- sum_child_expelled_disability|>
as_tibble()
sum_child_suspended_trauma <- sum_child_suspended_trauma|>
as_tibble()
sum_child_expelled_trauma <- sum_child_expelled_trauma|>
as_tibble()
sum_child_suspended_therapy <- sum_child_suspended_therapy|>
as_tibble()
sum_child_expelled_therapy <- sum_child_expelled_therapy|>
as_tibble()
sum_child_suspended_childcare_subsidy <- sum_child_suspended_childcare_subsidy|>
as_tibble()
sum_child_expelled_childcare_subsidy <- sum_child_expelled_childcare_subsidy|>
as_tibble()
sum_child_suspended_funding <- sum_child_suspended_funding|>
as_tibble()
sum_child_expelled_funding <- sum_child_expelled_funding|>
as_tibble()
sum_child_suspended_race_f <- sum_child_suspended_race_f|>
as_tibble()
sum_child_expelled_race_f <- sum_child_expelled_race_f|>
as_tibble()
write_xlsx(list (suspended_foster = sum_child_suspended_foster,
expelled_foster = sum_child_expelled_foster,
suspended_disabilty = sum_child_suspended_disability,
expelled_disability = sum_child_expelled_disability,
suspended_trauma = sum_child_suspended_trauma,
expelled_trauma = sum_child_expelled_trauma,
suspended_therapy = sum_child_suspended_therapy,
expelled_therapy = sum_child_expelled_therapy,
suspended_childcare_subsidy = sum_child_suspended_childcare_subsidy,
expelled_childcare_subsidy = sum_child_expelled_childcare_subsidy,
suspended_funding = sum_child_suspended_funding,
expelled_funding = sum_child_expelled_funding,
suspended_race = sum_child_suspended_race_f,
expelled_race = sum_child_expelled_race_f
), "EP Survey Child Characteristics Summary Data.xlsx")
write_xlsx(ep_data, "ep_data_child.xlsx")
# Write Graphs to PDF
library(ggpubr)
child_characteristics_graphs <- ggarrange(
sum_child_suspended_foster_g,
sum_child_expelled_foster_g,
sum_child_suspended_disability_g,
sum_child_expelled_disability_g,
sum_child_suspended_trauma_g,
sum_child_expelled_trauma_g,
sum_child_suspended_therapy_g,
sum_child_expelled_therapy_g,
sum_child_suspended_childcare_subsidy_g,
sum_child_expelled_childcare_subsidy_g,
sum_child_suspended_funding_g,
sum_child_expelled_funding_g,
sum_child_suspended_race_f_g,
sum_child_expelled_race_f_g,
nrow = 1, ncol = 1)
ggexport(child_characteristics_graphs,
filename = "child_characteristics_graphs.pdf")