KBB Analyzing CFM data - LeoLedesma237/LeoWebsite GitHub Wiki
Overall
We need to obtain the CFM data in its raw form and use it to come up with descriptive statistics that sever different functions. One of these is important for one of manuscripts we will be working on, the other is for informing the KBB project.
Part 1: General data loading
library(tidyverse)
library(readxl)
# Set the working directory
setwd("~/KBB_new_2")
# Load the ID data
Comprehensive.Screener.data <- read_excel("Comprehensive Screener Scoring.xlsx")
# Set the working directory
setwd("~/KBB_new_2/1_screener/final_data")
# Load in the binded data
Binded.data <- read_excel("All Children.xlsx")
# Keep variables of interest
Binded.data2 <- Binded.data %>%
select(Child_ID, KBB_CFM_DD_type) %>%
mutate(KBB_CFM_DD_status = ifelse(is.na(KBB_CFM_DD_type),"No","Yes"))
# Merge the datasets together
Comprehensive.Screener.data <- Comprehensive.Screener.data %>%
left_join(Binded.data2, by = "Child_ID")
Part 2: Remove incorrect CFM screeners
# Merge the datasets together
Comprehensive.Screener.data <- Comprehensive.Screener.data %>%
left_join(Binded.data2, by = "Child_ID")
Part 3: Set our inclusion criteria
- Must be 7-16 years old
- Must not have epilepsy
- Must not be blind, deaf, or immobile (ignore in the code for now)
# Inclusion criteria
# Within appropriate age range
Comprehensive.Screener.data2 <- Comprehensive.Screener.data %>%
filter(Child_age >= 7 & Child_age < 17)
# No Epilepsy
Comprehensive.Screener.data3 <- Comprehensive.Screener.data2 %>%
filter(Epilepsy == "No")
Part 4: Create four types of groups
The questions that will be used for ASD and language difficulties, non-ASD are Q21-23 (ASD) and Q15&16 (language).
- Neurotypical controls
- ASD traits (Prioritizes first)
- Language difficulties, non-ASD (Prioritizes second)
- Other DD (Prioritizes third)
# Creating a group variable
ASD <- c("CF20|CF21|CF22")
Lang <- c("CF15|CF16")
Comprehensive.Screener.data3 <- Comprehensive.Screener.data3 %>%
mutate(Group4 = case_when(
grepl(ASD, KBB_CFM_DD_type) ~ "ASD",
!grepl(ASD, KBB_CFM_DD_type) & grepl(Lang, KBB_CFM_DD_type) ~ "Language-no ASD",
is.na(KBB_CFM_DD_type) ~ "Control",
!grepl(ASD,KBB_CFM_DD_type) & !grepl(Lang, KBB_CFM_DD_type) ~ "DD no ASD nor Language",
TRUE ~ "Error"
))
Quality Control
Did the code create the desired groups correctly?
# Quality control
Comprehensive.Screener.data3 %>%
filter(Group4 == "ASD") %>%
view()
Comprehensive.Screener.data3 %>%
filter(Group4 == "Language-no ASD") %>%
view()
Comprehensive.Screener.data3 %>%
filter(Group4 == "DD no ASD nor Language") %>%
view()
Comprehensive.Screener.data3 %>%
filter(Group4 == "Control") %>%
view()
Comprehensive.Screener.data3 %>%
filter(Group4 == "Error") %>%
view()