This code chunk loads all packages needed for cleaning and organizing
the data. If the packages are not downloaded on your RStudio software,
you can first run install.packages() with the package name
within quotes inside the parentheses.
library(tidyverse)
library(here)
library(janitor)
library(rio)
library(writexl)
library(lubridate)
library(stringr)
demographics <- import(here("data", "Running_Data_File_Demographics.xlsx"),
setclass = "tbl_df")
results <- import(here("data", "Running_Data_File_Assessments.xlsx"),
setclass = "tbl_df") To properly merge the data, we can use left_join(), but
make sure the results data frame is on the left side of the function
because it is larger, meaning all data in this data frame will be kept,
and we will pull in the information from the demographic data that
aligns based on the Child ID variable.
Prior to data wrangling by assessment time and assessment type for data analysis and visualization, I like to update the structure of the data frame to make it easier to manipulate the different types of data. I like to program data as either numeric, factors, or dates.
## tibble [9,434 × 22] (S3: tbl_df/tbl/data.frame)
## $ SourceFile : chr [1:9434] "July2024-December2024" "July2024-December2024" "July2024-December2024" "July2024-December2024" ...
## $ Child ID : num [1:9434] 4637144 4637144 4637144 4637144 4637144 ...
## $ Assessment Date : POSIXct[1:9434], format: "2024-10-24" "2024-10-24" ...
## $ Category : chr [1:9434] "CASA of Santa Cruz Advocacy Planning Survey:INTAKE" "CASA of Santa Cruz Advocacy Planning Survey:INTAKE" "CASA of Santa Cruz Advocacy Planning Survey:INTAKE" "CASA of Santa Cruz Advocacy Planning Survey:INTAKE" ...
## $ Assessment : chr [1:9434] "1. ACEs (INTAKE) 6+" "1. ACEs (INTAKE) 6+" "1. ACEs (INTAKE) 6+" "1. ACEs (INTAKE) 6+" ...
## $ Total Child Score : num [1:9434] 5 5 5 5 5 5 5 5 5 5 ...
## $ Total Possible Score : num [1:9434] 10 10 10 10 10 10 10 10 10 10 ...
## $ Question Number : num [1:9434] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : chr [1:9434] "ACEs-Intro" "ACEs-Q1-Emotional Neglect" "ACEs-Q2-Emotional Abuse" "ACEs-Q3-Physical Neglect" ...
## $ Question : chr [1:9434] "Document any adverse childhood experiences. This list of experiences represent child experiences and caregiver "| __truncated__ "Emotional Neglect: Do you think the child ever felt unsupported, unloved and/or unprotected?" "Emotional Abuse: Has a parent/caregiver ever insulted, humiliated, or put down the child?" "Physical Neglect: Has the child ever lacked appropriate care by any caregiver? (for example, not being protecte"| __truncated__ ...
## $ Response Number : num [1:9434] 1 1 1 1 2 2 2 2 2 1 ...
## $ Response : chr [1:9434] "Click here to acknowledge that you’ve read these instructions." "Yes" "Yes" "Yes" ...
## $ Point Value : num [1:9434] 0 0 0 0 1 1 1 1 1 0 ...
## $ Assigned to Program Date: POSIXct[1:9434], format: "2023-10-20" "2023-10-20" ...
## $ Program Closure Date : logi [1:9434] NA NA NA NA NA NA ...
## $ Birthdate : POSIXct[1:9434], format: "2004-01-22" "2004-01-22" ...
## $ Gender : chr [1:9434] "Female" "Female" "Female" "Female" ...
## $ Race : chr [1:9434] "White" "White" "White" "White" ...
## $ Ethnicity : chr [1:9434] "Hispanic" "Hispanic" "Hispanic" "Hispanic" ...
## $ Language : chr [1:9434] "Bi-Lingual (English/Spanish)" "Bi-Lingual (English/Spanish)" "Bi-Lingual (English/Spanish)" "Bi-Lingual (English/Spanish)" ...
## $ Primary Language : chr [1:9434] NA NA NA NA ...
## $ Petition Type : chr [1:9434] "Dependency" "Dependency" "Dependency" "Dependency" ...
casa_data[sapply(casa_data, is.character)] <- lapply(casa_data[sapply(casa_data, is.character)],
as.factor)
casa_data <- casa_data %>%
mutate(`Child ID` = as.factor(`Child ID`),
`Question Name` = as.factor(`Question Name`))
casa_data$`Assessment Date` <- ymd(casa_data$`Assessment Date`)
casa_data$`Assigned to Program Date` <- ymd(casa_data$`Assigned to Program Date`)
casa_data$`Program Closure Date` <- ymd(casa_data$`Program Closure Date`)
casa_data$Birthdate <- ymd(casa_data$Birthdate)
casa_data <- casa_data %>%
mutate(`Assessment Date` = as.Date(`Assessment Date`),
`Assigned to Program Date` = as.Date(`Assigned to Program Date`),
`Program Closure Date` = as.Date(`Program Closure Date`),
Birthdate = as.Date(Birthdate))Last things to do before the data is ready:
Assessment Date and
Birthdate to make a new variable for
AssessmentAge and AssessmentAgeGroupcasa_data <- casa_data %>%
mutate(AssessmentAge = round(interval(Birthdate, `Assessment Date`) / years(1), 1))
casa_data <- casa_data %>%
mutate(
FiscalYear = case_when(
SourceFile == "July2024-December2024" ~ "FY 2024–25",
SourceFile == "January2025-June2025" ~ "FY 2024–25",
SourceFile == "July2025-December2025" ~ "FY 2025–26",
TRUE ~ NA_character_
)
)
casa_data <- casa_data %>%
select(c(24, 1:23))
casa_data <- casa_data %>%
mutate(FiscalYear = as.factor(FiscalYear))## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 176
## 2 1. ACEs (INTAKE) 6+ 1012
## 3 1. PACEs (Interim) 0-5 56
## 4 1. PACEs (Interim) 6+ 456
## 5 2. Wellbeing (INTAKE) 6+ 1196
## 6 2. Wellbeing (Interim) 6+ 741
## 7 2a. ASQ-3 (INTAKE) 0-5 90
## 8 2a. ASQ-3 (Interim) 0-5 42
## 9 2b. ASQ-SE (INTAKE) 0-5 30
## 10 2b. ASQ-SE (Interim) 0-5 14
## # ℹ 16 more rows
casa_data <- casa_data %>%
mutate(
AssessmentAgeGroup = case_when(
Assessment %in% c("1. ACEs (INTAKE) 0-5",
"1. PACEs (Interim) 0-5",
"2a. ASQ-3 (INTAKE) 0-5",
"2a. ASQ-3 (Interim) 0-5",
"2b. ASQ-SE (INTAKE) 0-5",
"2b. ASQ-SE (Interim) 0-5",
"3. Needs and Resources: Physical Health (INTAKE) 0-5",
"3. Needs and Resources: Physical Health (Interim) 0-5",
"4. Needs and Resources: Emotional Health (INTAKE) 0-5",
"4. Needs and Resources: Emotional Health (Interim) 0-5",
"5. Needs and Resources: Learning (INTAKE) 0-5",
"5. Needs and Resources: Learning (Interim) 0-5") ~ "0-5",
Assessment %in% c("1. ACEs (INTAKE) 6+",
"1. PACEs (Interim) 6+",
"2. Wellbeing (INTAKE) 6+",
"2. Wellbeing (Interim) 6+",
"3. Needs and Resources: Physical Health (INTAKE) 6+",
"3. Needs and Resources: Physical Health (Interim) 6+",
"4. Needs and Resources: Emotional Health (INTAKE) 6+",
"4. Needs and Resources: Emotional Health (Interim) 6+",
"5. Needs and Resources: Learning (INTAKE) 6+",
"5. Needs and Resources: Learning (Interim) 6+",
"6. Needs and Resources: Long Term Independence (INTAKE) 6+",
"6. Needs and Resources: Long Term Independence (Interim) 6+",
"7. Needs and Resources: Probation-Involved Youth (INTAKE) 6+",
"7. Needs and Resources: Probation-Involved Youth (Interim) 6+") ~ "6+",
)
)
casa_data <- casa_data %>%
select(c(1:3, 15:25, 4:14))
casa_data <- casa_data %>%
mutate(AssessmentAgeGroup = as.factor(AssessmentAgeGroup))Another last step we can do is to remove the intro question
statements from the data as they will not be needed for analysis or
visualizations.With those introduction statements removed, we can then
adjust the Question Number variable to appropriately align
the Question Number and Question Name
variables.
## # A tibble: 76 × 2
## `Question Name` n
## <fct> <int>
## 1 ACEs-Intro 108
## 2 ACEs-Q1-Emotional Neglect 108
## 3 ACEs-Q10-Parent Separation/Divorce 108
## 4 ACEs-Q2-Emotional Abuse 108
## 5 ACEs-Q3-Physical Neglect 108
## 6 ACEs-Q4-Physical Abuse 108
## 7 ACEs-Q5-Sexual Abuse 108
## 8 ACEs-Q6-Incarcerated Caregiver 108
## 9 ACEs-Q7-Caregiver Treated Violently 108
## 10 ACEs-Q8-Mental Health 108
## # ℹ 66 more rows
casa_data <- casa_data %>%
filter(`Question Name` != "ACEs-Intro" &
`Question Name` != "ASQ-3-DVMLS-Intro" &
`Question Name` != "EmotionalHealth-Intro" &
`Question Name` != "Learning-Intro" &
`Question Name` != "Longer Term-Intro" &
`Question Name` != "PhysicalHealth-Intro" &
`Question Name` != "ProbationYouth-Intro" &
`Question Name` != "Wellbeing-Intro" &
`Question Name` != "ASQ-SE Intro" &
`Question Name` != "PACEs-Intro")
casa_data <- casa_data %>%
mutate(`Question Number` = `Question Number` - 1)The Category variable indicates whether the assessment
entered was an intake or an interim. We can use that variable to isolate
all intake assessments to be organized into their own dataframe and
exported into .xlsx format.
## [1] "FiscalYear" "SourceFile"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge" "AssessmentAgeGroup"
## [15] "Assessment Date" "Category"
## [17] "Assessment" "Total Child Score"
## [19] "Total Possible Score" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number" "Response"
## [25] "Point Value"
## # A tibble: 2 × 2
## Category n
## <fct> <int>
## 1 CASA of Santa Cruz Advocacy Planning Survey:INTAKE 5312
## 2 CASA of Santa Cruz Advocacy Planning Survey:INTERIM 2979
Since the PACEs assessment is only collected at interim, we can isolate it and export into its own dataframe.
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
To align the data by individuals’ earliest intake and latest interim assessments, we need to split apart the data by assessment and rebuild the complete dataframe in our desired structure.
The goal is to arrange the data identifying cases that match the following scenarios:
This code chunk provides a function that we can replicate across all assessments.
filter_intake_interim <- function(
df,
intake_lbl,
interim_lbl,
id_col = "Child ID",
date_col = "Assessment Date",
assess_col = "Assessment"
) {
df <- df %>%
mutate(across(all_of(date_col), as.Date))
kids_both <- df %>%
group_by(.data[[id_col]]) %>%
summarise(
has_intake = any(.data[[assess_col]] == intake_lbl, na.rm = TRUE),
has_interim = any(.data[[assess_col]] == interim_lbl, na.rm = TRUE),
.groups = "drop"
) %>%
filter(has_intake & has_interim) %>%
select(.data[[id_col]])
df_filt <- df %>%
semi_join(kids_both, by = id_col)
intake_dates <- df_filt %>%
filter(.data[[assess_col]] == intake_lbl) %>%
group_by(.data[[id_col]]) %>%
summarise(intake_date = min(.data[[date_col]], na.rm = TRUE), .groups = "drop")
interim_dates <- df_filt %>%
filter(.data[[assess_col]] == interim_lbl) %>%
group_by(.data[[id_col]]) %>%
summarise(interim_date = max(.data[[date_col]], na.rm = TRUE), .groups = "drop")
intake <- df_filt %>%
filter(.data[[assess_col]] == intake_lbl) %>%
inner_join(intake_dates, by = id_col) %>%
filter(.data[[date_col]] == intake_date) %>%
select(-intake_date)
interim <- df_filt %>%
filter(.data[[assess_col]] == interim_lbl) %>%
inner_join(interim_dates, by = id_col) %>%
filter(.data[[date_col]] == interim_date) %>%
select(-interim_date)
list(intake = intake, interim = interim)
}
# Suffix non-key columns (idempotent + safer on reruns)
key_cols <- c("Child ID",
"Question Number",
"Question Name",
"Question")
suffix_once <- function(nm, suf) ifelse(grepl(paste0(suf, "$"), nm), nm, paste0(nm, suf))
demo_cols <- c(
"Birthdate",
"Gender",
"Race",
"Ethnicity",
"Language",
"Primary Language",
"Petition Type",
"Assigned to Program Date",
"Program Closure Date"
)## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
We want to identify cases with completed intake and interim assessments.
asq3_sets <- filter_intake_interim(
asq3,
intake_lbl = "2a. ASQ-3 (INTAKE) 0-5",
interim_lbl = "2a. ASQ-3 (Interim) 0-5"
)
asq3_intake <- asq3_sets$intake
asq3_interim <- asq3_sets$interim
asq3_intake_s <- asq3_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
asq3_interim_s <- asq3_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
asq3_joined <- left_join(
asq3_intake_s,
asq3_interim_s,
by = key_cols
)
asq3_clean <- asq3_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))## [1] "FiscalYear_intake" "SourceFile_intake"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [15] "Assessment Date_intake" "Category_intake"
## [17] "Assessment_intake" "Total Child Score_intake"
## [19] "Total Possible Score_intake" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number_intake" "Response_intake"
## [25] "Point Value_intake" "FiscalYear_interim"
## [27] "SourceFile_interim" "AssessmentAge_interim"
## [29] "AssessmentAgeGroup_interim" "Assessment Date_interim"
## [31] "Category_interim" "Assessment_interim"
## [33] "Total Child Score_interim" "Total Possible Score_interim"
## [35] "Response Number_interim" "Response_interim"
## [37] "Point Value_interim"
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
We want to identify cases with completed intake and interim assessments.
asq_se_sets <- filter_intake_interim(
asq_se,
intake_lbl = "2b. ASQ-SE (INTAKE) 0-5",
interim_lbl = "2b. ASQ-SE (Interim) 0-5"
)
asq_se_intake <- asq_se_sets$intake
asq_se_interim <- asq_se_sets$interim
asq_se_intake_s <- asq_se_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
asq_se_interim_s <- asq_se_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
asq_se_joined <- left_join(
asq_se_intake_s,
asq_se_interim_s,
by = key_cols
)
asq_se_clean <- asq_se_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))## [1] "FiscalYear_intake" "SourceFile_intake"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [15] "Assessment Date_intake" "Category_intake"
## [17] "Assessment_intake" "Total Child Score_intake"
## [19] "Total Possible Score_intake" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number_intake" "Response_intake"
## [25] "Point Value_intake" "FiscalYear_interim"
## [27] "SourceFile_interim" "AssessmentAge_interim"
## [29] "AssessmentAgeGroup_interim" "Assessment Date_interim"
## [31] "Category_interim" "Assessment_interim"
## [33] "Total Child Score_interim" "Total Possible Score_interim"
## [35] "Response Number_interim" "Response_interim"
## [37] "Point Value_interim"
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
wellbeing_sets <- filter_intake_interim(
wellbeing,
intake_lbl = "2. Wellbeing (INTAKE) 6+",
interim_lbl = "2. Wellbeing (Interim) 6+"
)
wellbeing_intake <- wellbeing_sets$intake
wellbeing_interim <- wellbeing_sets$interim
wellbeing_intake_s <- wellbeing_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
wellbeing_interim_s <- wellbeing_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
wellbeing_joined <- left_join(
wellbeing_intake_s,
wellbeing_interim_s,
by = key_cols
)
wellbeing_clean <- wellbeing_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))The Needs and Resources assessments require a few extra steps because we need to account for children who have 0-5 intake/interim, 6+ intake/interim, and 0-5 intake/6+ interim
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
physical_health_0_5 <- casa_data %>%
filter(Assessment == "3. Needs and Resources: Physical Health (INTAKE) 0-5" |
Assessment == "3. Needs and Resources: Physical Health (Interim) 0-5")
physical_health_6 <- casa_data %>%
filter(Assessment == "3. Needs and Resources: Physical Health (INTAKE) 6+" |
Assessment == "3. Needs and Resources: Physical Health (Interim) 6+")
physical_health_0_5_6 <- casa_data %>%
filter(Assessment == "3. Needs and Resources: Physical Health (INTAKE) 0-5" |
Assessment == "3. Needs and Resources: Physical Health (Interim) 6+")physicalhealth_sets_0_5 <- filter_intake_interim(
physical_health_0_5,
intake_lbl = "3. Needs and Resources: Physical Health (INTAKE) 0-5",
interim_lbl = "3. Needs and Resources: Physical Health (Interim) 0-5"
)
physicalhealth_0_5_intake <- physicalhealth_sets_0_5$intake
physicalhealth_0_5_interim <- physicalhealth_sets_0_5$interim
physicalhealth_0_5_intake_s <- physicalhealth_0_5_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
physicalhealth_0_5_interim_s <- physicalhealth_0_5_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
physicalhealth_0_5_joined <- left_join(
physicalhealth_0_5_intake_s,
physicalhealth_0_5_interim_s,
by = key_cols
)
physicalhealth_0_5_clean <- physicalhealth_0_5_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))physicalhealth_sets_6 <- filter_intake_interim(
physical_health_6,
intake_lbl = "3. Needs and Resources: Physical Health (INTAKE) 6+",
interim_lbl = "3. Needs and Resources: Physical Health (Interim) 6+"
)
physicalhealth_6_intake <- physicalhealth_sets_6$intake
physicalhealth_6_interim <- physicalhealth_sets_6$interim
physicalhealth_6_intake_s <- physicalhealth_6_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
physicalhealth_6_interim_s <- physicalhealth_6_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
physicalhealth_6_joined <- left_join(
physicalhealth_6_intake_s,
physicalhealth_6_interim_s,
by = key_cols
)
physicalhealth_6_clean <- physicalhealth_6_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))No cases meet the criteria of completing a physical health intake in the 0-5 age group and interim in the 6+ age group, but the code is provided below if ever needed.
#
# physicalhealth_sets_0_5_6 <- filter_intake_interim(
# physical_health_0_5_6,
# intake_lbl = "3. Needs and Resources: Physical Health (INTAKE) 0-5",
# interim_lbl = "3. Needs and Resources: Physical Health (Interim) 6+"
# )
#
# physicalhealth_0_5_6_intake <- physicalhealth_sets_0_5_6$intake
# physicalhealth_0_5_6_interim <- physicalhealth_sets_0_5_6$interim
#
#
#
# physicalhealth_0_5_6_intake_s <- physicalhealth_0_5_6_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# physicalhealth_0_5_6_interim_s <- physicalhealth_0_5_6_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# physicalhealth_0_5_6_joined <- left_join(
# physicalhealth_0_5_6_intake_s,
# physicalhealth_0_5_6_interim_s,
# by = key_cols
# )
#
# physicalhealth_0_5_6_clean <- physicalhealth_0_5_6_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))physicalhealth_0_5_clean <- physicalhealth_0_5_clean %>%
select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))
physicalhealth_6_clean <- physicalhealth_6_clean %>%
select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))
# physicalhealth_0_5_6_clean <- physicalhealth_0_5_6_clean %>%
# select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
emotional_health_0_5 <- casa_data %>%
filter(Assessment == "4. Needs and Resources: Emotional Health (INTAKE) 0-5" |
Assessment == "4. Needs and Resources: Emotional Health (Interim) 0-5")
emotional_health_6 <- casa_data %>%
filter(Assessment == "4. Needs and Resources: Emotional Health (INTAKE) 6+" |
Assessment == "4. Needs and Resources: Emotional Health (Interim) 6+")
emotional_health_0_5_6 <- casa_data %>%
filter(Assessment == "4. Needs and Resources: Emotional Health (INTAKE) 0-5" |
Assessment == "4. Needs and Resources: Emotional Health (Interim) 6+")emotionalhealth_sets_0_5 <- filter_intake_interim(
emotional_health_0_5,
intake_lbl = "4. Needs and Resources: Emotional Health (INTAKE) 0-5",
interim_lbl = "4. Needs and Resources: Emotional Health (Interim) 0-5"
)
emotionalhealth_0_5_intake <- emotionalhealth_sets_0_5$intake
emotionalhealth_0_5_interim <- emotionalhealth_sets_0_5$interim
#
# emotionalhealth_0_5_intake_s <- emotionalhealth_0_5_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# emotionalhealth_0_5_interim_s <- emotionalhealth_0_5_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# emotionalhealth_0_5_joined <- left_join(
# emotionalhealth_0_5_intake_s,
# emotionalhealth_0_5_interim_s,
# by = key_cols
# )
#
# emotionalhealth_0_5_clean <- emotionalhealth_0_5_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))
join_cols <- c("Child ID", "Question Number")
no_suffix_cols <- c("Child ID", "Question Number", "Question Name", "Question")
emotionalhealth_0_5_intake_s <- emotionalhealth_0_5_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
emotionalhealth_0_5_interim_s <- emotionalhealth_0_5_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
emotionalhealth_0_5_joined <- left_join(
emotionalhealth_0_5_intake_s,
emotionalhealth_0_5_interim_s %>% select(-all_of(c("Question Name", "Question"))),
by = join_cols
)
# QC: what would fail if you joined by full key_cols?
anti_join(emotionalhealth_0_5_intake, emotionalhealth_0_5_interim, by = key_cols) %>%
select(all_of(key_cols)) %>%
distinct() %>%
head(30)## # A tibble: 6 × 4
## `Child ID` `Question Number` `Question Name` Question
## <fct> <dbl> <fct> <fct>
## 1 7227234 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
## 2 7187587 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
## 3 7169486 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
## 4 7502618 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
## 5 7447643 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
## 6 7428752 7 EmotionalHealth-Q7-Extracurricular/Enri… Has ext…
emotionalhealth_0_5_clean <- emotionalhealth_0_5_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))emotionalhealth_sets_6 <- filter_intake_interim(
emotional_health_6,
intake_lbl = "4. Needs and Resources: Emotional Health (INTAKE) 6+",
interim_lbl = "4. Needs and Resources: Emotional Health (Interim) 6+"
)
emotionalhealth_6_intake <- emotionalhealth_sets_6$intake
emotionalhealth_6_interim <- emotionalhealth_sets_6$interim
# emotionalhealth_6_intake_s <- emotionalhealth_6_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# emotionalhealth_6_interim_s <- emotionalhealth_6_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# emotionalhealth_6_joined <- left_join(
# emotionalhealth_6_intake_s,
# emotionalhealth_6_interim_s,
# by = key_cols
# )
#
# emotionalhealth_6_clean <- emotionalhealth_6_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))
emotionalhealth_6_intake_s <- emotionalhealth_6_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
emotionalhealth_6_interim_s <- emotionalhealth_6_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
emotionalhealth_6_joined <- left_join(
emotionalhealth_6_intake_s,
emotionalhealth_6_interim_s %>% select(-all_of(c("Question Name", "Question"))),
by = join_cols
)
emotionalhealth_6_clean <- emotionalhealth_6_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))No cases meet the criteria of completing an emotional health intake in the 0-5 age group and interim in the 6+ age group, but the code is provided below if ever needed.
#
# emotionalhealth_sets_0_5_6 <- filter_intake_interim(
# emotional_health_0_5_6,
# intake_lbl = "4. Needs and Resources: Emotional Health (INTAKE) 0-5",
# interim_lbl = "4. Needs and Resources: Emotional Health (Interim) 6+"
# )
#
# emotionalhealth_0_5_6_intake <- emotionalhealth_sets_0_5_6$intake
# emotionalhealth_0_5_6_interim <- emotionalhealth_sets_0_5_6$interim
#
#
#
# emotionalhealth_0_5_6_intake_s <- emotionalhealth_0_5_6_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# emotionalhealth_0_5_6_interim_s <- emotionalhealth_0_5_6_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# emotionalhealth_0_5_6_joined <- left_join(
# emotionalhealth_0_5_6_intake_s,
# emotionalhealth_0_5_6_interim_s,
# by = key_cols
# )
#
# emotionalhealth_0_5_6_clean <- emotionalhealth_0_5_6_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))emotionalhealth_0_5_clean <- emotionalhealth_0_5_clean %>%
select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))
emotionalhealth_6_clean <- emotionalhealth_6_clean %>%
select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))
# emotionalhealth_0_5_6_clean <- emotionalhealth_0_5_6_clean %>%
# select(c(1, 26, 2, 27, 3:17, 28:32, 18:25, 33:37))## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
learning_0_5 <- casa_data %>%
filter(Assessment == "5. Needs and Resources: Learning (INTAKE) 0-5" |
Assessment == "5. Needs and Resources: Learning (Interim) 0-5")
learning_6 <- casa_data %>%
filter(Assessment == "5. Needs and Resources: Learning (INTAKE) 6+" |
Assessment == "5. Needs and Resources: Learning (Interim) 6+")
learning_0_5_6 <- casa_data %>%
filter(Assessment == "5. Needs and Resources: Learning (INTAKE) 0-5" |
Assessment == "5. Needs and Resources: Learning (Interim) 6+")learning_sets_0_5 <- filter_intake_interim(
learning_0_5,
intake_lbl = "5. Needs and Resources: Learning (INTAKE) 0-5",
interim_lbl = "5. Needs and Resources: Learning (Interim) 0-5"
)
learning_0_5_intake <- learning_sets_0_5$intake
learning_0_5_interim <- learning_sets_0_5$interim
learning_0_5_intake_s <- learning_0_5_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
learning_0_5_interim_s <- learning_0_5_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
learning_0_5_joined <- left_join(
learning_0_5_intake_s,
learning_0_5_interim_s,
by = key_cols
)
learning_0_5_clean <- learning_0_5_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))learning_sets_6 <- filter_intake_interim(
learning_6,
intake_lbl = "5. Needs and Resources: Learning (INTAKE) 6+",
interim_lbl = "5. Needs and Resources: Learning (Interim) 6+"
)
learning_6_intake <- learning_sets_6$intake
learning_6_interim <- learning_sets_6$interim
learning_6_intake_s <- learning_6_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
learning_6_interim_s <- learning_6_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
# 5) Join safely at question-row level
learning_6_joined <- left_join(
learning_6_intake_s,
learning_6_interim_s,
by = key_cols
)
learning_6_clean <- learning_6_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))No cases meet the criteria of completing a learning intake in the 0-5 age group and interim in the 6+ age group, but the code is provided below if ever needed.
#
# learning_sets_0_5_6 <- filter_intake_interim(
# learning_0_5_6,
# intake_lbl = "5. Needs and Resources: Learning (INTAKE) 0-5",
# interim_lbl = "5. Needs and Resources: Learning (Interim) 6+"
# )
#
# learning_0_5_6_intake <- learning_sets_0_5_6$intake
# learning_0_5_6_interim <- learning_sets_0_5_6$interim
#
#
#
# learning_0_5_6_intake_s <- learning_0_5_6_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# learning_0_5_6_interim_s <- learning_0_5_6_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# learning_0_5_6_joined <- left_join(
# learning_0_5_6_intake_s,
# learning_0_5_6_interim_s,
# by = key_cols
# )
#
# learning_0_5_6_clean <- learning_0_5_6_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))Long Term Indepedence appeared to have duplicated data entry so the steps were modified.
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
INTAKE_LBL <- "6. Needs and Resources: Long Term Independence (INTAKE) 6+"
INTERIM_LBL <- "6. Needs and Resources: Long Term Independence (Interim) 6+"
# LTI-specific item key (stronger than your global key_cols)
key_cols_lti <- c("Child ID", "Question Number", "Question Name")
LTI <- casa_data %>%
filter(Assessment %in% c(INTAKE_LBL, INTERIM_LBL)) %>%
distinct(
`Child ID`, Assessment, `Assessment Date`, SourceFile,
`Question Number`, `Question Name`, Question, Response, `Point Value`,
.keep_all = TRUE
)LTI_sets <- filter_intake_interim(
LTI,
intake_lbl = INTAKE_LBL,
interim_lbl = INTERIM_LBL
)
LTI_intake <- LTI_sets$intake
LTI_interim <- LTI_sets$interim
LTI_intake %>% count(across(all_of(key_cols_lti))) %>% summarise(max_n = max(n))## # A tibble: 1 × 1
## max_n
## <int>
## 1 1
## # A tibble: 1 × 1
## max_n
## <int>
## 1 1
LTI_intake_s <- LTI_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols_lti))
LTI_interim_s <- LTI_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols_lti))
LTI_joined <- inner_join(
LTI_intake_s,
LTI_interim_s,
by = key_cols_lti
)
LTI_clean <- LTI_joined %>%
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
select(-all_of(paste0(demo_cols, "_interim")))## [1] "FiscalYear_intake" "SourceFile_intake"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [15] "Assessment Date_intake" "Category_intake"
## [17] "Assessment_intake" "Total Child Score_intake"
## [19] "Total Possible Score_intake" "Question Number"
## [21] "Question Name" "Question_intake"
## [23] "Response Number_intake" "Response_intake"
## [25] "Point Value_intake" "FiscalYear_interim"
## [27] "SourceFile_interim" "AssessmentAge_interim"
## [29] "AssessmentAgeGroup_interim" "Assessment Date_interim"
## [31] "Category_interim" "Assessment_interim"
## [33] "Total Child Score_interim" "Total Possible Score_interim"
## [35] "Question_interim" "Response Number_interim"
## [37] "Response_interim" "Point Value_interim"
## # A tibble: 26 × 2
## Assessment n
## <fct> <int>
## 1 1. ACEs (INTAKE) 0-5 160
## 2 1. ACEs (INTAKE) 6+ 920
## 3 1. PACEs (Interim) 0-5 49
## 4 1. PACEs (Interim) 6+ 399
## 5 2. Wellbeing (INTAKE) 6+ 1104
## 6 2. Wellbeing (Interim) 6+ 684
## 7 2a. ASQ-3 (INTAKE) 0-5 75
## 8 2a. ASQ-3 (Interim) 0-5 35
## 9 2b. ASQ-SE (INTAKE) 0-5 15
## 10 2b. ASQ-SE (Interim) 0-5 7
## # ℹ 16 more rows
PIY_sets <- filter_intake_interim(
PIY,
intake_lbl = "7. Needs and Resources: Probation-Involved Youth (INTAKE) 6+",
interim_lbl = "7. Needs and Resources: Probation-Involved Youth (Interim) 6+"
)
PIY_intake <- PIY_sets$intake
PIY_interim <- PIY_sets$interim
#
# PIY_intake_s <- PIY_intake %>%
# rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(key_cols))
#
# PIY_interim_s <- PIY_interim %>%
# rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(key_cols))
#
# # 5) Join safely at question-row level
# PIY_joined <- left_join(
# PIY_intake_s,
# PIY_interim_s,
# by = key_cols
# )
#
# PIY_clean <- PIY_joined %>%
# # keep intake version, rename back to original
# rename_with(
# ~ str_remove(.x, "_intake$"),
# .cols = all_of(paste0(demo_cols, "_intake"))
# ) %>%
# # drop interim duplicates
# select(-all_of(paste0(demo_cols, "_interim")))
PIY_intake_s <- PIY_intake %>%
rename_with(~ suffix_once(.x, "_intake"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
PIY_interim_s <- PIY_interim %>%
rename_with(~ suffix_once(.x, "_interim"), .cols = -all_of(no_suffix_cols)) %>%
distinct(across(all_of(join_cols)), .keep_all = TRUE)
PIY_joined <- left_join(
PIY_intake_s,
PIY_interim_s %>% select(-all_of(c("Question Name", "Question"))),
by = join_cols
)
PIY_clean <- PIY_joined %>%
# keep intake version, rename back to original
rename_with(
~ str_remove(.x, "_intake$"),
.cols = all_of(paste0(demo_cols, "_intake"))
) %>%
# drop interim duplicates
select(-all_of(paste0(demo_cols, "_interim")))casa_intake_interim <- bind_rows(asq3_clean,
wellbeing_clean,
physicalhealth_0_5_clean,
physicalhealth_6_clean,
emotionalhealth_0_5_clean,
emotionalhealth_6_clean,
learning_0_5_clean,
learning_6_clean,
LTI_clean,
PIY_clean,
.id = "DataFrameSource")
casa_intake_interim <- casa_intake_interim %>%
arrange(`Child ID`)
str(casa_intake_interim)## tibble [2,176 × 38] (S3: tbl_df/tbl/data.frame)
## $ DataFrameSource : chr [1:2176] "2" "2" "2" "2" ...
## $ FiscalYear_intake : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_intake : Factor w/ 3 levels "January2025-June2025",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Assigned to Program Date : Date[1:2176], format: "2023-10-23" "2023-10-23" ...
## $ Program Closure Date : Date[1:2176], format: NA NA ...
## $ Birthdate : Date[1:2176], format: "2006-08-28" "2006-08-28" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 1 1 1 1 1 1 1 1 1 1 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ AssessmentAge_intake : num [1:2176] 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 ...
## $ AssessmentAgeGroup_intake : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment Date_intake : Date[1:2176], format: "2024-10-31" "2024-10-31" ...
## $ Category_intake : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assessment_intake : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ AssessmentAge_interim : num [1:2176] 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment Date_interim : Date[1:2176], format: "2025-11-18" "2025-11-18" ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Total Child Score_intake : num [1:2176] 18 18 18 18 18 18 18 18 18 18 ...
## $ Total Possible Score_intake : num [1:2176] 36 36 36 36 36 36 36 36 36 36 ...
## $ Question Number : num [1:2176] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 24 25 26 73 74 75 12 13 14 15 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 10 74 9 2 1 25 14 58 77 75 ...
## $ Response Number_intake : num [1:2176] 2 1 2 2 1 1 1 3 1 1 ...
## $ Response_intake : Factor w/ 29 levels "Above cutoff",..: 27 26 27 27 26 26 26 5 26 26 ...
## $ Point Value_intake : num [1:2176] 2 1 2 2 1 1 1 3 1 1 ...
## $ Total Child Score_interim : num [1:2176] 25 25 25 25 25 25 25 25 25 25 ...
## $ Total Possible Score_interim: num [1:2176] 36 36 36 36 36 36 36 36 36 36 ...
## $ Response Number_interim : num [1:2176] 3 3 3 2 2 1 1 2 2 3 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 5 5 5 27 27 26 26 27 27 5 ...
## $ Point Value_interim : num [1:2176] 3 3 3 2 2 1 1 2 2 3 ...
casa_intake_interim <- casa_intake_interim %>%
mutate(DataFrameSource = as.factor(DataFrameSource))
casa_intake_interim$DataFrameSource <- recode(casa_intake_interim$DataFrameSource,
`1` = "ASQ-3_0-5",
`2` = "Wellbeing_6+",
`3` = "PhysicalHealth_0-5",
`4` = "PhysicalHealth_6+",
`5` = "EmotionalHealth_0-5",
`6` = "EmotionalHealth_6+",
`7` = "Learning_0-5",
`8` = "Learning_6+",
`9` = "LongTermIndependence_6+",
`10` = "ProbationInvolvedYouth_6+")
# reorder to desired column order
names(casa_intake_interim)## [1] "DataFrameSource" "FiscalYear_intake"
## [3] "FiscalYear_interim" "SourceFile_intake"
## [5] "SourceFile_interim" "Child ID"
## [7] "Assigned to Program Date" "Program Closure Date"
## [9] "Birthdate" "Gender"
## [11] "Race" "Ethnicity"
## [13] "Language" "Primary Language"
## [15] "Petition Type" "AssessmentAge_intake"
## [17] "AssessmentAgeGroup_intake" "Assessment Date_intake"
## [19] "Category_intake" "Assessment_intake"
## [21] "AssessmentAge_interim" "AssessmentAgeGroup_interim"
## [23] "Assessment Date_interim" "Category_interim"
## [25] "Assessment_interim" "Total Child Score_intake"
## [27] "Total Possible Score_intake" "Question Number"
## [29] "Question Name" "Question"
## [31] "Response Number_intake" "Response_intake"
## [33] "Point Value_intake" "Total Child Score_interim"
## [35] "Total Possible Score_interim" "Response Number_interim"
## [37] "Response_interim" "Point Value_interim"
casa_intake_interim <- casa_intake_interim %>%
select(DataFrameSource,
FiscalYear_intake,
FiscalYear_interim,
SourceFile_intake,
SourceFile_interim,
`Child ID`,
Birthdate,
Gender,
Race,
Ethnicity,
Language,
`Primary Language`,
`Petition Type`,
`Assigned to Program Date`,
`Program Closure Date`,
`Assessment Date_intake`,
`Assessment Date_interim`,
Category_intake,
Category_interim,
Assessment_intake,
Assessment_interim,
AssessmentAge_intake,
AssessmentAgeGroup_intake,
AssessmentAge_interim,
AssessmentAgeGroup_interim,
`Question Number`,
`Question Name`,
Question,
`Total Child Score_intake`,
`Total Possible Score_intake`,
`Response Number_intake`,
Response_intake,
`Point Value_intake`,
`Total Child Score_interim`,
`Total Possible Score_interim`,
`Response Number_interim`,
Response_interim,
`Point Value_interim`)To section walks through how to isolate cases where there is a present interim assessment but no corresponding intake data for the following scenarios:
No observations meet the criteria, but the code is provided below if/when needed.
# asq_se_only_interim <- asq_se %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# asq_se_most_recent_interim <- asq_se_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)No observations meet the criteria, but the code is provided below if/when needed.
# wellbeing_only_interim <- wellbeing %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# wellbeing_most_recent_interim <- wellbeing_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)No observations meet the criteria, but the code is provided below if/when needed.
# ph05_only_interim <- physical_health_0_5 %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# ph05_most_recent_interim <- ph05_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)No observations meet the criteria, but the code is provided below if/when needed.
# ph_6_only_interim <- physical_health_6 %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# ph_6_most_recent_interim <- ph_6_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)eh05_only_interim <- emotional_health_0_5 %>%
group_by(`Child ID`) %>%
filter(all(str_detect(Assessment, "Interim")) &
!any(str_detect(Assessment, "INTAKE")))
eh05_most_recent_interim <- eh05_only_interim %>%
group_by(`Child ID`) %>%
filter(`Assessment Date` == max(`Assessment Date`)) %>%
arrange(`Child ID`)No observations meet the criteria, but the code is provided below if/when needed.
# eh_6_only_interim <- emotional_health_6 %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# eh_6_most_recent_interim <- eh_6_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)learning_05_only_interim <- learning_0_5 %>%
group_by(`Child ID`) %>%
filter(all(str_detect(Assessment, "Interim")) &
!any(str_detect(Assessment, "INTAKE")))
learning_05_most_recent_interim <- learning_05_only_interim %>%
group_by(`Child ID`) %>%
filter(`Assessment Date` == max(`Assessment Date`)) %>%
arrange(`Child ID`)learning_6_only_interim <- learning_6 %>%
group_by(`Child ID`) %>%
filter(all(str_detect(Assessment, "Interim")) &
!any(str_detect(Assessment, "INTAKE")))
learning_6_most_recent_interim <- learning_6_only_interim %>%
group_by(`Child ID`) %>%
filter(`Assessment Date` == max(`Assessment Date`)) %>%
arrange(`Child ID`)No cases meet this criteria, but the code is provided below if/when needed in the future.
# piy_6_only_interim <- PIY %>%
# group_by(`Child ID`) %>%
# filter(all(str_detect(Assessment, "Interim")) &
# !any(str_detect(Assessment, "INTAKE")))
#
#
# piy_6_most_recent_interim <- piy_6_only_interim %>%
# group_by(`Child ID`) %>%
# filter(`Assessment Date` == max(`Assessment Date`)) %>%
# arrange(`Child ID`)casa_data_missing_intake <- bind_rows(asq3_most_recent_interim,
eh05_most_recent_interim,
learning_05_most_recent_interim,
learning_6_most_recent_interim,
lti_6_most_recent_interim,
.id = "DataFrameSource")
casa_data_missing_intake <- casa_data_missing_intake %>%
arrange(`Child ID`)
str(casa_data_missing_intake)## gropd_df [36 × 26] (S3: grouped_df/tbl_df/tbl/data.frame)
## $ DataFrameSource : chr [1:36] "4" "4" "4" "4" ...
## $ FiscalYear : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile : Factor w/ 3 levels "January2025-June2025",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 19 19 19 19 19 19 19 68 68 68 ...
## $ Assigned to Program Date: Date[1:36], format: "2021-10-22" "2021-10-22" ...
## $ Program Closure Date : Date[1:36], format: NA NA ...
## $ Birthdate : Date[1:36], format: "2007-03-30" "2007-03-30" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 2 2 2 2 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 2 2 2 2 2 2 2 2 2 2 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 2 2 2 2 2 2 2 1 1 1 ...
## $ AssessmentAge : num [1:36] 18.3 18.3 18.3 18.3 18.3 18.3 18.3 5.9 5.9 5.9 ...
## $ AssessmentAgeGroup : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 1 1 1 ...
## $ Assessment Date : Date[1:36], format: "2025-07-01" "2025-07-01" ...
## $ Category : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 22 22 22 22 22 22 22 8 8 8 ...
## $ Total Child Score : num [1:36] 21 21 21 21 21 21 21 9 9 9 ...
## $ Total Possible Score : num [1:36] 21 21 21 21 21 21 21 15 15 15 ...
## $ Question Number : num [1:36] 1 2 3 4 5 6 7 1 2 3 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 38 39 40 41 42 43 44 16 18 17 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 29 12 54 32 7 41 69 13 31 30 ...
## $ Response Number : num [1:36] 5 3 5 3 3 3 3 2 2 2 ...
## $ Response : Factor w/ 29 levels "Above cutoff",..: 13 29 17 29 29 29 29 4 4 4 ...
## $ Point Value : num [1:36] 3 3 3 3 3 3 3 2 2 2 ...
## - attr(*, "groups")= tibble [3 × 2] (S3: tbl_df/tbl/data.frame)
## ..$ Child ID: Factor w/ 106 levels "4636048","4636223",..: 19 68 86
## ..$ .rows : list<int> [1:3]
## .. ..$ : int [1:7] 1 2 3 4 5 6 7
## .. ..$ : int [1:21] 8 9 10 11 12 13 14 15 16 17 ...
## .. ..$ : int [1:8] 29 30 31 32 33 34 35 36
## .. ..@ ptype: int(0)
## ..- attr(*, ".drop")= logi TRUE
casa_data_missing_intake <- casa_data_missing_intake %>%
mutate(DataFrameSource = as.factor(DataFrameSource))
casa_data_missing_intake %>%
count(DataFrameSource)## # A tibble: 5 × 3
## # Groups: Child ID [3]
## `Child ID` DataFrameSource n
## <fct> <fct> <int>
## 1 6499641 4 7
## 2 7385016 1 5
## 3 7385016 2 9
## 4 7385016 3 7
## 5 7524470 5 8
casa_data_missing_intake$DataFrameSource <- recode(casa_data_missing_intake$DataFrameSource,
`1` = "ASQ-3_0-5",
`2` = "EmotionalHealth_0-5",
`3` = "Learning_0-5",
`4` = "Learning_6+",
`5` = "LongTermIndependence_6+")
# reorder to desired column order
names(casa_data_missing_intake)## [1] "DataFrameSource" "FiscalYear"
## [3] "SourceFile" "Child ID"
## [5] "Assigned to Program Date" "Program Closure Date"
## [7] "Birthdate" "Gender"
## [9] "Race" "Ethnicity"
## [11] "Language" "Primary Language"
## [13] "Petition Type" "AssessmentAge"
## [15] "AssessmentAgeGroup" "Assessment Date"
## [17] "Category" "Assessment"
## [19] "Total Child Score" "Total Possible Score"
## [21] "Question Number" "Question Name"
## [23] "Question" "Response Number"
## [25] "Response" "Point Value"
There are now four individual files to explore data:
To combine everything into one master file, we need to ensure all four individual files have the same number of columns, column names, and column structure.
## [1] "FiscalYear" "SourceFile"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge" "AssessmentAgeGroup"
## [15] "Assessment Date" "Category"
## [17] "Assessment" "Total Child Score"
## [19] "Total Possible Score" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number" "Response"
## [25] "Point Value"
## [1] "FiscalYear" "SourceFile"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge" "AssessmentAgeGroup"
## [15] "Assessment Date" "Category"
## [17] "Assessment" "Total Child Score"
## [19] "Total Possible Score" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number" "Response"
## [25] "Point Value"
## [1] "DataFrameSource" "FiscalYear"
## [3] "SourceFile" "Child ID"
## [5] "Assigned to Program Date" "Program Closure Date"
## [7] "Birthdate" "Gender"
## [9] "Race" "Ethnicity"
## [11] "Language" "Primary Language"
## [13] "Petition Type" "AssessmentAge"
## [15] "AssessmentAgeGroup" "Assessment Date"
## [17] "Category" "Assessment"
## [19] "Question Number" "Question Name"
## [21] "Question" "Total Child Score"
## [23] "Total Possible Score" "Response Number"
## [25] "Response" "Point Value"
## # A tibble: 5 × 3
## # Groups: Child ID [3]
## `Child ID` DataFrameSource n
## <fct> <fct> <int>
## 1 6499641 Learning_6+ 7
## 2 7385016 ASQ-3_0-5 5
## 3 7385016 EmotionalHealth_0-5 9
## 4 7385016 Learning_0-5 7
## 5 7524470 LongTermIndependence_6+ 8
## [1] "DataFrameSource" "FiscalYear_intake"
## [3] "FiscalYear_interim" "SourceFile_intake"
## [5] "SourceFile_interim" "Child ID"
## [7] "Birthdate" "Gender"
## [9] "Race" "Ethnicity"
## [11] "Language" "Primary Language"
## [13] "Petition Type" "Assigned to Program Date"
## [15] "Program Closure Date" "Assessment Date_intake"
## [17] "Assessment Date_interim" "Category_intake"
## [19] "Category_interim" "Assessment_intake"
## [21] "Assessment_interim" "AssessmentAge_intake"
## [23] "AssessmentAgeGroup_intake" "AssessmentAge_interim"
## [25] "AssessmentAgeGroup_interim" "Question Number"
## [27] "Question Name" "Question"
## [29] "Total Child Score_intake" "Total Possible Score_intake"
## [31] "Response Number_intake" "Response_intake"
## [33] "Point Value_intake" "Total Child Score_interim"
## [35] "Total Possible Score_interim" "Response Number_interim"
## [37] "Response_interim" "Point Value_interim"
## # A tibble: 10 × 2
## DataFrameSource n
## <fct> <int>
## 1 ASQ-3_0-5 30
## 2 ProbationInvolvedYouth_6+ 156
## 3 Wellbeing_6+ 624
## 4 PhysicalHealth_0-5 21
## 5 PhysicalHealth_6+ 150
## 6 EmotionalHealth_0-5 54
## 7 EmotionalHealth_6+ 414
## 8 Learning_0-5 42
## 9 Learning_6+ 357
## 10 LongTermIndependence_6+ 328
The Intakes only, Interim only, and Missing Intake/Interim only data
frames require additional columns padded with set values or
NA values to align with the Intake-Interim data frame.
casa_data_intake_for_bind <- casa_data_intake %>%
rename("FiscalYear_intake" = FiscalYear,
"SourceFile_intake" = SourceFile,
"AssessmentAge_intake" = AssessmentAge,
"AssessmentAgeGroup_intake" = AssessmentAgeGroup,
"Assessment Date_intake" = `Assessment Date`,
"Category_intake" = Category,
"Assessment_intake" = Assessment,
"Total Child Score_intake" = `Total Child Score`,
"Total Possible Score_intake" = `Total Possible Score`,
"Response Number_intake" = `Response Number`,
"Response_intake" = Response,
"Point Value_intake" = `Point Value`) %>%
mutate(`DataFrameSource` = "IntakeOnlyData",
`FiscalYear_interim` = NA,
`SourceFile_interim` = NA,
`AssessmentAge_interim` = NA,
`AssessmentAgeGroup_interim` = NA,
`Assessment Date_interim` = NA,
`Category_interim` = NA,
`Assessment_interim` = NA,
`Total Child Score_interim` = NA,
`Total Possible Score_interim` = NA,
`Response Number_interim` = NA,
`Response_interim` = NA,
`Point Value_interim` = NA)
str(casa_data_intake_for_bind)## tibble [5,074 × 38] (S3: tbl_df/tbl/data.frame)
## $ FiscalYear_intake : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ SourceFile_intake : Factor w/ 3 levels "January2025-June2025",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Assigned to Program Date : Date[1:5074], format: "2023-10-20" "2023-10-20" ...
## $ Program Closure Date : Date[1:5074], format: NA NA ...
## $ Birthdate : Date[1:5074], format: "2004-01-22" "2004-01-22" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 1 1 1 1 1 1 1 1 1 1 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ AssessmentAge_intake : num [1:5074] 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 ...
## $ AssessmentAgeGroup_intake : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment Date_intake : Date[1:5074], format: "2024-10-24" "2024-10-24" ...
## $ Category_intake : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assessment_intake : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Total Child Score_intake : num [1:5074] 5 5 5 5 5 5 5 5 5 5 ...
## $ Total Possible Score_intake : num [1:5074] 10 10 10 10 10 10 10 10 10 10 ...
## $ Question Number : num [1:5074] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 2 4 5 6 7 8 9 10 11 3 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 27 26 67 65 70 55 11 60 72 63 ...
## $ Response Number_intake : num [1:5074] 1 1 1 2 2 2 2 2 1 1 ...
## $ Response_intake : Factor w/ 29 levels "Above cutoff",..: 29 29 29 21 21 21 21 21 29 29 ...
## $ Point Value_intake : num [1:5074] 0 0 0 1 1 1 1 1 0 0 ...
## $ DataFrameSource : chr [1:5074] "IntakeOnlyData" "IntakeOnlyData" "IntakeOnlyData" "IntakeOnlyData" ...
## $ FiscalYear_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ SourceFile_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ AssessmentAge_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Assessment Date_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Category_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Assessment_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Total Child Score_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Total Possible Score_interim: logi [1:5074] NA NA NA NA NA NA ...
## $ Response Number_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Response_interim : logi [1:5074] NA NA NA NA NA NA ...
## $ Point Value_interim : logi [1:5074] NA NA NA NA NA NA ...
casa_data_intake_for_bind <- casa_data_intake_for_bind %>%
mutate(DataFrameSource = as.factor(DataFrameSource)) %>%
mutate(across(where(is.logical), as.factor))
names(casa_data_intake_for_bind)## [1] "FiscalYear_intake" "SourceFile_intake"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [15] "Assessment Date_intake" "Category_intake"
## [17] "Assessment_intake" "Total Child Score_intake"
## [19] "Total Possible Score_intake" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number_intake" "Response_intake"
## [25] "Point Value_intake" "DataFrameSource"
## [27] "FiscalYear_interim" "SourceFile_interim"
## [29] "AssessmentAge_interim" "AssessmentAgeGroup_interim"
## [31] "Assessment Date_interim" "Category_interim"
## [33] "Assessment_interim" "Total Child Score_interim"
## [35] "Total Possible Score_interim" "Response Number_interim"
## [37] "Response_interim" "Point Value_interim"
casa_data_intake_for_bind <- casa_data_intake_for_bind %>%
select(c(DataFrameSource,
FiscalYear_intake,
FiscalYear_interim,
SourceFile_intake,
SourceFile_interim,
`Child ID`,
Birthdate,
Gender,
Race,
Ethnicity,
Language,
`Primary Language`,
`Petition Type`,
`Assigned to Program Date`,
`Program Closure Date`,
`Assessment Date_intake`,
`Assessment Date_interim`,
Category_intake,
Category_interim,
Assessment_intake,
Assessment_interim,
AssessmentAge_intake,
AssessmentAgeGroup_intake,
AssessmentAge_interim,
AssessmentAgeGroup_interim,
`Question Number`,
`Question Name`,
Question,
`Total Child Score_intake`,
`Total Possible Score_intake`,
`Response Number_intake`,
Response_intake,
`Point Value_intake`,
`Total Child Score_interim`,
`Total Possible Score_interim`,
`Response Number_interim`,
Response_interim,
`Point Value_interim`))casa_data_PACEs_interim_for_bind <- casa_data_PACEs_interim %>%
rename("FiscalYear_interim" = FiscalYear,
"SourceFile_interim" = SourceFile,
"AssessmentAge_interim" = AssessmentAge,
"AssessmentAgeGroup_interim" = AssessmentAgeGroup,
"Assessment Date_interim" = `Assessment Date`,
"Category_interim" = Category,
"Assessment_interim" = Assessment,
"Total Child Score_interim" = `Total Child Score`,
"Total Possible Score_interim" = `Total Possible Score`,
"Response Number_interim" = `Response Number`,
"Response_interim" = Response,
"Point Value_interim" = `Point Value`) %>%
mutate(`DataFrameSource` = "InterimOnlyPACEsData",
`FiscalYear_intake` = NA,
`SourceFile_intake` = NA,
`AssessmentAge_intake` = NA,
`AssessmentAgeGroup_intake` = NA,
`Assessment Date_intake` = NA,
`Category_intake` = NA,
`Assessment_intake` = NA,
`Total Child Score_intake` = NA,
`Total Possible Score_intake` = NA,
`Response Number_intake` = NA,
`Response_intake` = NA,
`Point Value_intake` = NA)
str(casa_data_PACEs_interim_for_bind)## tibble [399 × 38] (S3: tbl_df/tbl/data.frame)
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 35 35 35 35 35 35 35 33 33 33 ...
## $ Assigned to Program Date : Date[1:399], format: "2024-05-13" "2024-05-13" ...
## $ Program Closure Date : Date[1:399], format: NA NA ...
## $ Birthdate : Date[1:399], format: "2009-09-06" "2009-09-06" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 2 2 2 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 2 2 2 2 2 2 2 2 2 2 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ AssessmentAge_interim : num [1:399] 15.7 15.7 15.7 15.7 15.7 15.7 15.7 10.2 10.2 10.2 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment Date_interim : Date[1:399], format: "2025-06-05" "2025-06-05" ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Total Child Score_interim : num [1:399] 4 4 4 4 4 4 4 4 4 4 ...
## $ Total Possible Score_interim: num [1:399] 7 7 7 7 7 7 7 7 7 7 ...
## $ Question Number : num [1:399] 1 2 3 4 5 6 7 1 2 3 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 55 56 57 58 59 60 61 55 56 57 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 3 59 61 62 66 71 73 3 59 61 ...
## $ Response Number_interim : num [1:399] 1 2 2 1 1 2 1 1 2 2 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 29 21 21 29 29 21 29 29 21 21 ...
## $ Point Value_interim : num [1:399] 1 0 0 1 1 0 1 1 0 0 ...
## $ DataFrameSource : chr [1:399] "InterimOnlyPACEsData" "InterimOnlyPACEsData" "InterimOnlyPACEsData" "InterimOnlyPACEsData" ...
## $ FiscalYear_intake : logi [1:399] NA NA NA NA NA NA ...
## $ SourceFile_intake : logi [1:399] NA NA NA NA NA NA ...
## $ AssessmentAge_intake : logi [1:399] NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Assessment Date_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Category_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Assessment_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Total Child Score_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Total Possible Score_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Response Number_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Response_intake : logi [1:399] NA NA NA NA NA NA ...
## $ Point Value_intake : logi [1:399] NA NA NA NA NA NA ...
casa_data_PACEs_interim_for_bind <- casa_data_PACEs_interim_for_bind %>%
mutate(DataFrameSource = as.factor(DataFrameSource)) %>%
mutate(across(where(is.logical), as.factor))
names(casa_data_PACEs_interim_for_bind)## [1] "FiscalYear_interim" "SourceFile_interim"
## [3] "Child ID" "Assigned to Program Date"
## [5] "Program Closure Date" "Birthdate"
## [7] "Gender" "Race"
## [9] "Ethnicity" "Language"
## [11] "Primary Language" "Petition Type"
## [13] "AssessmentAge_interim" "AssessmentAgeGroup_interim"
## [15] "Assessment Date_interim" "Category_interim"
## [17] "Assessment_interim" "Total Child Score_interim"
## [19] "Total Possible Score_interim" "Question Number"
## [21] "Question Name" "Question"
## [23] "Response Number_interim" "Response_interim"
## [25] "Point Value_interim" "DataFrameSource"
## [27] "FiscalYear_intake" "SourceFile_intake"
## [29] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [31] "Assessment Date_intake" "Category_intake"
## [33] "Assessment_intake" "Total Child Score_intake"
## [35] "Total Possible Score_intake" "Response Number_intake"
## [37] "Response_intake" "Point Value_intake"
casa_data_PACEs_interim_for_bind <- casa_data_PACEs_interim_for_bind %>%
select(c(DataFrameSource,
FiscalYear_intake,
FiscalYear_interim,
SourceFile_intake,
SourceFile_interim,
`Child ID`,
Birthdate,
Gender,
Race,
Ethnicity,
Language,
`Primary Language`,
`Petition Type`,
`Assigned to Program Date`,
`Program Closure Date`,
`Assessment Date_intake`,
`Assessment Date_interim`,
Category_intake,
Category_interim,
Assessment_intake,
Assessment_interim,
AssessmentAge_intake,
AssessmentAgeGroup_intake,
AssessmentAge_interim,
AssessmentAgeGroup_interim,
`Question Number`,
`Question Name`,
Question,
`Total Child Score_intake`,
`Total Possible Score_intake`,
`Response Number_intake`,
Response_intake,
`Point Value_intake`,
`Total Child Score_interim`,
`Total Possible Score_interim`,
`Response Number_interim`,
Response_interim,
`Point Value_interim`))casa_data_missing_intake_for_bind <- casa_data_missing_intake %>%
rename("FiscalYear_interim" = FiscalYear,
"SourceFile_interim" = SourceFile,
"AssessmentAge_interim" = AssessmentAge,
"AssessmentAgeGroup_interim" = AssessmentAgeGroup,
"Assessment Date_interim" = `Assessment Date`,
"Category_interim" = Category,
"Assessment_interim" = Assessment,
"Total Child Score_interim" = `Total Child Score`,
"Total Possible Score_interim" = `Total Possible Score`,
"Response Number_interim" = `Response Number`,
"Response_interim" = Response,
"Point Value_interim" = `Point Value`) %>%
mutate(`FiscalYear_intake` = NA,
`SourceFile_intake` = NA,
`AssessmentAge_intake` = NA,
`AssessmentAgeGroup_intake` = NA,
`Assessment Date_intake` = NA,
`Category_intake` = NA,
`Assessment_intake` = NA,
`Total Child Score_intake` = NA,
`Total Possible Score_intake` = NA,
`Response Number_intake` = NA,
`Response_intake` = NA,
`Point Value_intake` = NA)
str(casa_data_missing_intake_for_bind)## gropd_df [36 × 38] (S3: grouped_df/tbl_df/tbl/data.frame)
## $ DataFrameSource : Factor w/ 5 levels "Learning_6+",..: 1 1 1 1 1 1 1 2 2 2 ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 19 19 19 19 19 19 19 68 68 68 ...
## $ Assigned to Program Date : Date[1:36], format: "2021-10-22" "2021-10-22" ...
## $ Program Closure Date : Date[1:36], format: NA NA ...
## $ Birthdate : Date[1:36], format: "2007-03-30" "2007-03-30" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 2 2 2 2 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 2 2 2 2 2 2 2 2 2 2 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 2 2 2 2 2 2 2 1 1 1 ...
## $ AssessmentAge_interim : num [1:36] 18.3 18.3 18.3 18.3 18.3 18.3 18.3 5.9 5.9 5.9 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 1 1 1 ...
## $ Assessment Date_interim : Date[1:36], format: "2025-07-01" "2025-07-01" ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 22 22 22 22 22 22 22 8 8 8 ...
## $ Question Number : num [1:36] 1 2 3 4 5 6 7 1 2 3 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 38 39 40 41 42 43 44 16 18 17 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 29 12 54 32 7 41 69 13 31 30 ...
## $ Total Child Score_interim : num [1:36] 21 21 21 21 21 21 21 9 9 9 ...
## $ Total Possible Score_interim: num [1:36] 21 21 21 21 21 21 21 15 15 15 ...
## $ Response Number_interim : num [1:36] 5 3 5 3 3 3 3 2 2 2 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 13 29 17 29 29 29 29 4 4 4 ...
## $ Point Value_interim : num [1:36] 3 3 3 3 3 3 3 2 2 2 ...
## $ FiscalYear_intake : logi [1:36] NA NA NA NA NA NA ...
## $ SourceFile_intake : logi [1:36] NA NA NA NA NA NA ...
## $ AssessmentAge_intake : logi [1:36] NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Assessment Date_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Category_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Assessment_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Total Child Score_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Total Possible Score_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Response Number_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Response_intake : logi [1:36] NA NA NA NA NA NA ...
## $ Point Value_intake : logi [1:36] NA NA NA NA NA NA ...
## - attr(*, "groups")= tibble [3 × 2] (S3: tbl_df/tbl/data.frame)
## ..$ Child ID: Factor w/ 106 levels "4636048","4636223",..: 19 68 86
## ..$ .rows : list<int> [1:3]
## .. ..$ : int [1:7] 1 2 3 4 5 6 7
## .. ..$ : int [1:21] 8 9 10 11 12 13 14 15 16 17 ...
## .. ..$ : int [1:8] 29 30 31 32 33 34 35 36
## .. ..@ ptype: int(0)
## ..- attr(*, ".drop")= logi TRUE
casa_data_missing_intake_for_bind <- casa_data_missing_intake_for_bind %>%
mutate(across(where(is.logical), as.factor))
names(casa_data_missing_intake_for_bind)## [1] "DataFrameSource" "FiscalYear_interim"
## [3] "SourceFile_interim" "Child ID"
## [5] "Assigned to Program Date" "Program Closure Date"
## [7] "Birthdate" "Gender"
## [9] "Race" "Ethnicity"
## [11] "Language" "Primary Language"
## [13] "Petition Type" "AssessmentAge_interim"
## [15] "AssessmentAgeGroup_interim" "Assessment Date_interim"
## [17] "Category_interim" "Assessment_interim"
## [19] "Question Number" "Question Name"
## [21] "Question" "Total Child Score_interim"
## [23] "Total Possible Score_interim" "Response Number_interim"
## [25] "Response_interim" "Point Value_interim"
## [27] "FiscalYear_intake" "SourceFile_intake"
## [29] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [31] "Assessment Date_intake" "Category_intake"
## [33] "Assessment_intake" "Total Child Score_intake"
## [35] "Total Possible Score_intake" "Response Number_intake"
## [37] "Response_intake" "Point Value_intake"
casa_data_missing_intake_for_bind <- casa_data_missing_intake_for_bind %>%
select(c(DataFrameSource,
FiscalYear_intake,
FiscalYear_interim,
SourceFile_intake,
SourceFile_interim,
`Child ID`,
Birthdate,
Gender,
Race,
Ethnicity,
Language,
`Primary Language`,
`Petition Type`,
`Assigned to Program Date`,
`Program Closure Date`,
`Assessment Date_intake`,
`Assessment Date_interim`,
Category_intake,
Category_interim,
Assessment_intake,
Assessment_interim,
AssessmentAge_intake,
AssessmentAgeGroup_intake,
AssessmentAge_interim,
AssessmentAgeGroup_interim,
`Question Number`,
`Question Name`,
Question,
`Total Child Score_intake`,
`Total Possible Score_intake`,
`Response Number_intake`,
Response_intake,
`Point Value_intake`,
`Total Child Score_interim`,
`Total Possible Score_interim`,
`Response Number_interim`,
Response_interim,
`Point Value_interim`))## tibble [5,074 × 38] (S3: tbl_df/tbl/data.frame)
## $ DataFrameSource : Factor w/ 1 level "IntakeOnlyData": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_intake : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ SourceFile_intake : Factor w/ 3 levels "January2025-June2025",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Birthdate : Date[1:5074], format: "2004-01-22" "2004-01-22" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 1 1 1 1 1 1 1 1 1 1 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assigned to Program Date : Date[1:5074], format: "2023-10-20" "2023-10-20" ...
## $ Program Closure Date : Date[1:5074], format: NA NA ...
## $ Assessment Date_intake : Date[1:5074], format: "2024-10-24" "2024-10-24" ...
## $ Assessment Date_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Category_intake : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Category_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment_intake : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAge_intake : num [1:5074] 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 ...
## $ AssessmentAgeGroup_intake : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ AssessmentAge_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Question Number : num [1:5074] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 2 4 5 6 7 8 9 10 11 3 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 27 26 67 65 70 55 11 60 72 63 ...
## $ Total Child Score_intake : num [1:5074] 5 5 5 5 5 5 5 5 5 5 ...
## $ Total Possible Score_intake : num [1:5074] 10 10 10 10 10 10 10 10 10 10 ...
## $ Response Number_intake : num [1:5074] 1 1 1 2 2 2 2 2 1 1 ...
## $ Response_intake : Factor w/ 29 levels "Above cutoff",..: 29 29 29 21 21 21 21 21 29 29 ...
## $ Point Value_intake : num [1:5074] 0 0 0 1 1 1 1 1 0 0 ...
## $ Total Child Score_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Total Possible Score_interim: Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response Number_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Point Value_interim : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## tibble [399 × 38] (S3: tbl_df/tbl/data.frame)
## $ DataFrameSource : Factor w/ 1 level "InterimOnlyPACEsData": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ SourceFile_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 35 35 35 35 35 35 35 33 33 33 ...
## $ Birthdate : Date[1:399], format: "2009-09-06" "2009-09-06" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 2 2 2 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 2 2 2 2 2 2 2 2 2 2 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assigned to Program Date : Date[1:399], format: "2024-05-13" "2024-05-13" ...
## $ Program Closure Date : Date[1:399], format: NA NA ...
## $ Assessment Date_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment Date_interim : Date[1:399], format: "2025-06-05" "2025-06-05" ...
## $ Category_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ AssessmentAge_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAge_interim : num [1:399] 15.7 15.7 15.7 15.7 15.7 15.7 15.7 10.2 10.2 10.2 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Question Number : num [1:399] 1 2 3 4 5 6 7 1 2 3 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 55 56 57 58 59 60 61 55 56 57 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 3 59 61 62 66 71 73 3 59 61 ...
## $ Total Child Score_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Total Possible Score_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response Number_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Point Value_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Total Child Score_interim : num [1:399] 4 4 4 4 4 4 4 4 4 4 ...
## $ Total Possible Score_interim: num [1:399] 7 7 7 7 7 7 7 7 7 7 ...
## $ Response Number_interim : num [1:399] 1 2 2 1 1 2 1 1 2 2 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 29 21 21 29 29 21 29 29 21 21 ...
## $ Point Value_interim : num [1:399] 1 0 0 1 1 0 1 1 0 0 ...
## gropd_df [36 × 38] (S3: grouped_df/tbl_df/tbl/data.frame)
## $ DataFrameSource : Factor w/ 5 levels "Learning_6+",..: 1 1 1 1 1 1 1 2 2 2 ...
## $ FiscalYear_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 19 19 19 19 19 19 19 68 68 68 ...
## $ Birthdate : Date[1:36], format: "2007-03-30" "2007-03-30" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 2 2 2 2 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 2 2 2 2 2 2 2 2 2 2 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 2 2 2 2 2 2 2 1 1 1 ...
## $ Assigned to Program Date : Date[1:36], format: "2021-10-22" "2021-10-22" ...
## $ Program Closure Date : Date[1:36], format: NA NA ...
## $ Assessment Date_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment Date_interim : Date[1:36], format: "2025-07-01" "2025-07-01" ...
## $ Category_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 22 22 22 22 22 22 22 8 8 8 ...
## $ AssessmentAge_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAge_interim : num [1:36] 18.3 18.3 18.3 18.3 18.3 18.3 18.3 5.9 5.9 5.9 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 1 1 1 ...
## $ Question Number : num [1:36] 1 2 3 4 5 6 7 1 2 3 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 38 39 40 41 42 43 44 16 18 17 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 29 12 54 32 7 41 69 13 31 30 ...
## $ Total Child Score_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Total Possible Score_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response Number_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Response_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Point Value_intake : Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
## $ Total Child Score_interim : num [1:36] 21 21 21 21 21 21 21 9 9 9 ...
## $ Total Possible Score_interim: num [1:36] 21 21 21 21 21 21 21 15 15 15 ...
## $ Response Number_interim : num [1:36] 5 3 5 3 3 3 3 2 2 2 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 13 29 17 29 29 29 29 4 4 4 ...
## $ Point Value_interim : num [1:36] 3 3 3 3 3 3 3 2 2 2 ...
## - attr(*, "groups")= tibble [3 × 2] (S3: tbl_df/tbl/data.frame)
## ..$ Child ID: Factor w/ 106 levels "4636048","4636223",..: 19 68 86
## ..$ .rows : list<int> [1:3]
## .. ..$ : int [1:7] 1 2 3 4 5 6 7
## .. ..$ : int [1:21] 8 9 10 11 12 13 14 15 16 17 ...
## .. ..$ : int [1:8] 29 30 31 32 33 34 35 36
## .. ..@ ptype: int(0)
## ..- attr(*, ".drop")= logi TRUE
## tibble [2,176 × 38] (S3: tbl_df/tbl/data.frame)
## $ DataFrameSource : Factor w/ 10 levels "ASQ-3_0-5","ProbationInvolvedYouth_6+",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ FiscalYear_intake : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_intake : Factor w/ 3 levels "January2025-June2025",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ Birthdate : Date[1:2176], format: "2006-08-28" "2006-08-28" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 1 1 1 1 1 1 1 1 1 1 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assigned to Program Date : Date[1:2176], format: "2023-10-23" "2023-10-23" ...
## $ Program Closure Date : Date[1:2176], format: NA NA ...
## $ Assessment Date_intake : Date[1:2176], format: "2024-10-31" "2024-10-31" ...
## $ Assessment Date_interim : Date[1:2176], format: "2025-11-18" "2025-11-18" ...
## $ Category_intake : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_intake : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ AssessmentAge_intake : num [1:2176] 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 18.2 ...
## $ AssessmentAgeGroup_intake : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ AssessmentAge_interim : num [1:2176] 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 19.2 ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ Question Number : num [1:2176] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 24 25 26 73 74 75 12 13 14 15 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 10 74 9 2 1 25 14 58 77 75 ...
## $ Total Child Score_intake : num [1:2176] 18 18 18 18 18 18 18 18 18 18 ...
## $ Total Possible Score_intake : num [1:2176] 36 36 36 36 36 36 36 36 36 36 ...
## $ Response Number_intake : num [1:2176] 2 1 2 2 1 1 1 3 1 1 ...
## $ Response_intake : Factor w/ 29 levels "Above cutoff",..: 27 26 27 27 26 26 26 5 26 26 ...
## $ Point Value_intake : num [1:2176] 2 1 2 2 1 1 1 3 1 1 ...
## $ Total Child Score_interim : num [1:2176] 25 25 25 25 25 25 25 25 25 25 ...
## $ Total Possible Score_interim: num [1:2176] 36 36 36 36 36 36 36 36 36 36 ...
## $ Response Number_interim : num [1:2176] 3 3 3 2 2 1 1 2 2 3 ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: 5 5 5 27 27 26 26 27 27 5 ...
## $ Point Value_interim : num [1:2176] 3 3 3 2 2 1 1 2 2 3 ...
casa_data_intake_for_bind <- casa_data_intake_for_bind %>%
mutate(AssessmentAge_intake = as.numeric(AssessmentAge_intake),
AssessmentAge_interim = as.numeric(AssessmentAge_interim),
`Assessment Date_intake` = as.Date(`Assessment Date_intake`),
`Assessment Date_interim` = as.Date(`Assessment Date_interim`),
`Total Child Score_intake` = as.numeric(`Total Child Score_intake`),
`Total Child Score_interim` = as.numeric(`Total Child Score_interim`),
`Total Possible Score_intake` = as.numeric(`Total Possible Score_intake`),
`Total Possible Score_interim` = as.numeric(`Total Possible Score_interim`),
`Point Value_intake` = as.numeric(`Point Value_intake`),
`Point Value_interim` = as.numeric(`Point Value_interim`),
AssessmentAgeGroup_intake = as.factor(AssessmentAgeGroup_intake),
AssessmentAgeGroup_interim = as.factor(AssessmentAgeGroup_interim),
`Response Number_intake` = as.numeric(`Response Number_intake`),
`Response Number_interim` = as.numeric(`Response Number_interim`))
casa_data_PACEs_interim_for_bind <- casa_data_PACEs_interim_for_bind %>%
mutate(AssessmentAge_intake = as.numeric(AssessmentAge_intake),
AssessmentAge_interim = as.numeric(AssessmentAge_interim),
`Assessment Date_intake` = as.Date(`Assessment Date_intake`),
`Assessment Date_interim` = as.Date(`Assessment Date_interim`),
`Total Child Score_intake` = as.numeric(`Total Child Score_intake`),
`Total Child Score_interim` = as.numeric(`Total Child Score_interim`),
`Total Possible Score_intake` = as.numeric(`Total Possible Score_intake`),
`Total Possible Score_interim` = as.numeric(`Total Possible Score_interim`),
`Point Value_intake` = as.numeric(`Point Value_intake`),
`Point Value_interim` = as.numeric(`Point Value_interim`),
AssessmentAgeGroup_intake = as.factor(AssessmentAgeGroup_intake),
AssessmentAgeGroup_interim = as.factor(AssessmentAgeGroup_interim),
`Response Number_intake` = as.numeric(`Response Number_intake`),
`Response Number_interim` = as.numeric(`Response Number_interim`))
casa_data_missing_intake_for_bind <- casa_data_missing_intake_for_bind %>%
mutate(AssessmentAge_intake = as.numeric(AssessmentAge_intake),
AssessmentAge_interim = as.numeric(AssessmentAge_interim),
`Assessment Date_intake` = as.Date(`Assessment Date_intake`),
`Assessment Date_interim` = as.Date(`Assessment Date_interim`),
`Total Child Score_intake` = as.numeric(`Total Child Score_intake`),
`Total Child Score_interim` = as.numeric(`Total Child Score_interim`),
`Total Possible Score_intake` = as.numeric(`Total Possible Score_intake`),
`Total Possible Score_interim` = as.numeric(`Total Possible Score_interim`),
`Point Value_intake` = as.numeric(`Point Value_intake`),
`Point Value_interim` = as.numeric(`Point Value_interim`),
AssessmentAgeGroup_intake = as.factor(AssessmentAgeGroup_intake),
AssessmentAgeGroup_interim = as.factor(AssessmentAgeGroup_interim),
`Response Number_intake` = as.numeric(`Response Number_intake`),
`Response Number_interim` = as.numeric(`Response Number_interim`))
combined_master_casa_data <- bind_rows(casa_data_intake_for_bind,
casa_data_PACEs_interim_for_bind,
casa_data_missing_intake_for_bind,
casa_intake_interim,
.id = "MasterDataID")
str(combined_master_casa_data)## tibble [7,685 × 39] (S3: tbl_df/tbl/data.frame)
## $ MasterDataID : chr [1:7685] "1" "1" "1" "1" ...
## $ DataFrameSource : Factor w/ 12 levels "IntakeOnlyData",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_intake : Factor w/ 2 levels "FY 2024–25","FY 2025–26": 1 1 1 1 1 1 1 1 1 1 ...
## $ FiscalYear_interim : Factor w/ 2 levels "FY 2024–25","FY 2025–26": NA NA NA NA NA NA NA NA NA NA ...
## $ SourceFile_intake : Factor w/ 3 levels "January2025-June2025",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ SourceFile_interim : Factor w/ 3 levels "January2025-June2025",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Child ID : Factor w/ 106 levels "4636048","4636223",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ Birthdate : Date[1:7685], format: "2004-01-22" "2004-01-22" ...
## $ Gender : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
## $ Race : Factor w/ 6 levels "American Indian or Alaska Native",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ Ethnicity : Factor w/ 2 levels "Hispanic","Non-Hispanic": 1 1 1 1 1 1 1 1 1 1 ...
## $ Language : Factor w/ 4 levels "Bi-Lingual (English/Spanish)",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Primary Language : Factor w/ 4 levels "False","No","True",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Petition Type : Factor w/ 4 levels "Dependency","Dual Status",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Assigned to Program Date : Date[1:7685], format: "2023-10-20" "2023-10-20" ...
## $ Program Closure Date : Date[1:7685], format: NA NA ...
## $ Assessment Date_intake : Date[1:7685], format: "2024-10-24" "2024-10-24" ...
## $ Assessment Date_interim : Date[1:7685], format: NA NA ...
## $ Category_intake : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Category_interim : Factor w/ 2 levels "CASA of Santa Cruz Advocacy Planning Survey:INTAKE",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Assessment_intake : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ Assessment_interim : Factor w/ 26 levels "1. ACEs (INTAKE) 0-5",..: NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAge_intake : num [1:7685] 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 20.8 ...
## $ AssessmentAgeGroup_intake : Factor w/ 2 levels "0-5","6+": 2 2 2 2 2 2 2 2 2 2 ...
## $ AssessmentAge_interim : num [1:7685] NA NA NA NA NA NA NA NA NA NA ...
## $ AssessmentAgeGroup_interim : Factor w/ 2 levels "0-5","6+": NA NA NA NA NA NA NA NA NA NA ...
## $ Question Number : num [1:7685] 1 2 3 4 5 6 7 8 9 10 ...
## $ Question Name : Factor w/ 76 levels "ACEs-Intro","ACEs-Q1-Emotional Neglect",..: 2 4 5 6 7 8 9 10 11 3 ...
## $ Question : Factor w/ 77 levels "Able to calm themselves",..: 27 26 67 65 70 55 11 60 72 63 ...
## $ Total Child Score_intake : num [1:7685] 5 5 5 5 5 5 5 5 5 5 ...
## $ Total Possible Score_intake : num [1:7685] 10 10 10 10 10 10 10 10 10 10 ...
## $ Response Number_intake : num [1:7685] 1 1 1 2 2 2 2 2 1 1 ...
## $ Response_intake : Factor w/ 29 levels "Above cutoff",..: 29 29 29 21 21 21 21 21 29 29 ...
## $ Point Value_intake : num [1:7685] 0 0 0 1 1 1 1 1 0 0 ...
## $ Total Child Score_interim : num [1:7685] NA NA NA NA NA NA NA NA NA NA ...
## $ Total Possible Score_interim: num [1:7685] NA NA NA NA NA NA NA NA NA NA ...
## $ Response Number_interim : num [1:7685] NA NA NA NA NA NA NA NA NA NA ...
## $ Response_interim : Factor w/ 29 levels "Above cutoff",..: NA NA NA NA NA NA NA NA NA NA ...
## $ Point Value_interim : num [1:7685] NA NA NA NA NA NA NA NA NA NA ...
combined_master_casa_data <- combined_master_casa_data %>%
mutate(MasterDataID = as.factor(MasterDataID))
combined_master_casa_data$MasterDataID <- recode(combined_master_casa_data$MasterDataID,
`1` = "IntakesOnlyDataFrame",
`2` ="InterimOnlyDataFram(PACEs)",
`3` = "MissingIntakeDataFrame",
`4` = "InakeInterimDataFrame")To assist with data visualization, we can reformat the master data file to have long and wide components, creating a new variable to indicate whether the assessment is an Intake or an Interim entry.
Through a series of splitting apart the data frame using
pivot_longer() into individual parts, we can then rebind all the
individual pieces into the desired reformatted design. All variables
that have an _intake or _interim suffix need
to be pivoted.
## [1] "MasterDataID" "DataFrameSource"
## [3] "FiscalYear_intake" "FiscalYear_interim"
## [5] "SourceFile_intake" "SourceFile_interim"
## [7] "Child ID" "Birthdate"
## [9] "Gender" "Race"
## [11] "Ethnicity" "Language"
## [13] "Primary Language" "Petition Type"
## [15] "Assigned to Program Date" "Program Closure Date"
## [17] "Assessment Date_intake" "Assessment Date_interim"
## [19] "Category_intake" "Category_interim"
## [21] "Assessment_intake" "Assessment_interim"
## [23] "AssessmentAge_intake" "AssessmentAgeGroup_intake"
## [25] "AssessmentAge_interim" "AssessmentAgeGroup_interim"
## [27] "Question Number" "Question Name"
## [29] "Question" "Total Child Score_intake"
## [31] "Total Possible Score_intake" "Response Number_intake"
## [33] "Response_intake" "Point Value_intake"
## [35] "Total Child Score_interim" "Total Possible Score_interim"
## [37] "Response Number_interim" "Response_interim"
## [39] "Point Value_interim"
refomat_master_casa_data <- bind_cols(AssessmentAge_pivot,
AssessmentAgeGroup_pivot,
AssessmentDate_pivot,
Category_pivot,
Assessment_pivot,
TotalChildScore_pivot,
TotalPossibleScore_pivot,
ResponseNumber_pivot,
Response_pivot,
PointValue_pivot,
SourceFile_pivot,
FiscalYear_pivot)
names(refomat_master_casa_data)## [1] "MasterDataID" "DataFrameSource"
## [3] "Child ID" "Birthdate"
## [5] "Gender" "Race"
## [7] "Ethnicity" "Language"
## [9] "Primary Language" "Petition Type"
## [11] "Assigned to Program Date" "Program Closure Date"
## [13] "Question Number" "Question Name"
## [15] "Question" "Stage"
## [17] "AssessmentAge" "AssessmentAgeGroup"
## [19] "AssessmentDate" "Category"
## [21] "Assessment" "Total Child Score"
## [23] "Total Possible Score" "Response Number"
## [25] "Response" "Point value"
## [27] "Source File" "FiscalYear"