-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
177 lines (135 loc) · 8.72 KB
/
README.Rmd
File metadata and controls
177 lines (135 loc) · 8.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# abcdutils
<!-- badges: start -->
<!-- badges: end -->
A collection of utility functions for working with the Adolescent Brain and Cognitive Development dataset.
## Installation
You can install abcdutils from [GitHub](https://github.com/) with:
```{r eval = FALSE}
# Latest development version
devtools::install_github("psvelayudhan/abcdutils")
# Install a specific tagged version
devtools::install_github("psvelayudhan/abcdutils@v0.4.0")
```
## Usage
### Working with the data dictionary
```{r eval = FALSE}
library(abcdutils)
library(readr)
# Search the NDA's data dictionary from R
search_dd("traumatic brain injury")
# Launch the data dictionary in your browser
open_dd()
```
### Extract cleaned dataframes
Subcortical volumes (structural MRI)
```{r eval = FALSE}
subc_v <- get_subc_v(mri_y_smr_vol_aseg)
```
Subcortical volumes for a predefined set of subjects and a specific collection event
```{r eval = FALSE}
# Dataframe containing "subjectkey" column
subject_df <- read_csv("subjectlist.csv")
subc_v <- get_subc_v(
mri_y_smr_vol_aseg,
subjects = subject_df,
t = 0
)
```
(where `t = 0` refers to baseline data)
Extraction available for a wide range of variables related to neuroimaging, demographics, psychosocial resilience, and medical history:
| Function | Description |
| ---- | ----- |
| get_cbcl_syndrome_scale | Raw or T-scores of the anxdep, withdep, somatic, social, thought, attention, rulebreak, and attention subscales |
| get_cort_sa | Cortical surface area |
| get_cort_t | Cortical thickness |
| get_exercise | A composite measure of exercise time from the Youth Risk Behavior Survey |
| get_family_function | Parent and youth responses to the Famiily Environment Scale |
| get_family_id | Family-specific ID variable |
| get_friends | Number of same and opposite sex close and total friends |
| get_gender_p | Parent report of child's gender |
| get_gender_y | Youth's self report of gender |
| get_gord_cor | Cortical-cortical rs-fMRI network correlations |
| get_gord_var | Cortical-cortical rs-fMRI temporal variances |
| get_headaches | Headache history |
| get_income | Three-tiered family income |
| get_interview_age | Child age at data collection |
| get_mtbi_age | Age at latest concussion |
| get_mtbi_count | Total number of concussions |
| get_mtbi_loc | LOC status for last concussion |
| get_mtbi_mechanism | Mechanism of acquiring last concussion |
| get_mtbi_mem_daze | Memory loss / dazed status of last concussion |
| get_mtbi_subjects | Identify children who have had a concussion |
| get_nihtbx_cardsort_fc | NIH toolbox card sorting task |
| get_nihtbx_list_fc | NIH toolbox list sorting task |
| get_parent_psychopathology | Parent self report scores from ASEBA |
| get_prosocial_behaviour_p | Parent reports of child prosocial behaviour |
| get_prosocial_behaviour_y | Child self reports of prosocial behaviour |
| get_pubertal_status_p | Parent report of child pubertal status |
| get_pubertal_status_y | Youth self report of pubertal status |
| get_race | Child ethnicity |
| get_scanner_id | Scanner-specific ID variable |
| get_screen_time | Screentime on weekdays and weekends in hours |
| get_site_id | Site-specific ID variable |
| get_sex | Sex at birth |
| get_sleep_disturbance | Sum of problems on Sleep Disturbance Scale |
| get_sports_and_activities | Total participation in sports and activities |
| get_subc_cor | Subcortical-cortical rs-fMRI network correlations |
| get_subc_v | Subcortical volume |
| get_subc_var | Subcortical-cortical rs-fMRI temporal variances |
| get_uninjured_subjects | Identify children who have not had any head injuries |
| get_wmnd | Neurite densities of major and peri-cortical white matter regions |
### Simple subsetting
```{r eval = FALSE}
abcd_otbi01 <- read_csv("abcd_otbi01.txt")
# Subset to just baseline data
filter_timepoint(abcd_otbi01, 0)
# Or just year 1 follow-up data
filter_timepoint(abcd_otbi01, 1)
# Or just subjects of interest
filter_subjects(abcd_otbi01, subject_list)
```
### Concussion data prep
```{r eval = FALSE}
abcd_otbi01 <- read_csv("abcd_otbi01.txt")
# Renaming columns to be easily interpretable:
rename_tbi(abcd_otbi01)
# Identify which subjects had an mTBI and which had a moderate+ head injury:
identify_all_tbi(abcd_otbi01)
# Identify which head injuries were mTBIs
identify_mtbi(abcd_otbi01)
# When did the mTBIs occur
identify_mtbi_times(abcd_otbi01)
# What mechanism caused their latest mTBI
identify_latest_mtbi_mechanism(abcd_otbi01)
# How many mTBIs did the subject experience
identify_num_mtbi(abcd_otbi01)
# How much LOC occurred for the subject's most recent injury
identify_latest_mtbi_loc(abcd_otbi01)
# Did memory loss / feeling dazed or confused occur on the most recent injury
identify_latest_mtbi_mem_daze(abcd_otbi01)
# Combine all the functions above
detail_mtbi(abcd_otbi01)
```
### Plotting
```{r eval = FALSE}
# Visualize missing data across several dataframes
df_list <- list(
"loss of consciousness" = as_mtbi_loc,
"mechanism of injury" = as_mtbi_mechanism,
"memory loss / dazed" = as_mtbi_mem_daze,
"income" = d_income
)
vis_missing_by_df(df_list)
```