-This html file illustrates initial data cleaning, primarily showing output. Several large code chunks -have been hidden from the html file to improve readability.
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(naniar)
library(gtsummary)
knitr::opts_chunk$set(include = TRUE, echo = TRUE)
headers <- read.csv("/Users/noahwolkowicz/Desktop/CT/West Haven/Postdoc/Postdoc Research/Jenn & Noah Collab/Data/JN_Data_6.1.22.csv", skip = 0, header = F, nrows = 1, as.is = T)
df <- read_csv("/Users/noahwolkowicz/Desktop/CT/West Haven/Postdoc/Postdoc Research/Jenn & Noah Collab/Data/JN_Data_6.1.22.csv", skip = 2)
## Rows: 892 Columns: 614
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (538): {"ImportId":"status"}, {"ImportId":"ipAddress"}, {"ImportId":"_r...
## dbl (67): {"ImportId":"progress"}, {"ImportId":"duration"}, {"ImportId":"l...
## lgl (6): {"ImportId":"finished"}, {"ImportId":"recipientLastName"}, {"Imp...
## dttm (3): {"ImportId":"startDate","timeZone":"America/Denver"}, {"ImportId...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
colnames(df) <- headers
dim(df)
## [1] 892 616
#892 people with 616 variables
df %>% janitor::tabyl(Data_Use)
## Data_Use n percent
## Do not use my data. I did not devote my full attention. 87 0.09753363
## Use my data. I devoted my full attention. 708 0.79372197
## <NA> 97 0.10874439
## valid_percent
## 0.109434
## 0.890566
## NA
df %>% janitor::tabyl(Failed_ATTN_Checks.f)
## Failed_ATTN_Checks.f n percent valid_percent
## Failed 168 0.18834081 0.1992883
## Passed 675 0.75672646 0.8007117
## <NA> 49 0.05493274 NA
table(df$Data_Use, df$Failed_ATTN_Checks.f)
##
## Failed Passed
## Do not use my data. I did not devote my full attention. 47 40
## Use my data. I devoted my full attention. 110 598
#Statistical assessment of significant differences in attentive responding across conditions
chisq.test(df$Failed_ATTN_Checks, df$Condition)
##
## Pearson's Chi-squared test
##
## data: df$Failed_ATTN_Checks and df$Condition
## X-squared = 1.4779, df = 2, p-value = 0.4776
chisq.test(df$Data_Use, df$Condition)
##
## Pearson's Chi-squared test
##
## data: df$Data_Use and df$Condition
## X-squared = 0.86774, df = 2, p-value = 0.648
#Removing participants who failed any attention check or requested their data not be used
df <- df %>% filter(Failed_ATTN_Checks.f == "Passed") %>% filter(Data_Use == "Use my data. I devoted my full attention.")
#### Checking if anyone is missing condition assignment ####
dim(df[is.na(df$Condition),]) #1 person missing/not assigned to a condition
## [1] 1 624
missing_condition <- df[is.na(df$Condition), 1]
table(missing_condition$PMI_Writing, missing_condition$`Neutral Writing`, missing_condition$NMI_Writing)
## < table of extent 0 x 0 x 0 >
#^Code above verifies that my initial coding to create a condition variable didn't exclude anyone
missing_condition <- df %>% filter(is.na(Condition)) #Make separate df to look at this person
mean(is.na(missing_condition)) #They're missing 25% of their data
## [1] 0.2532051
miss_cond_vars <- missing_condition %>% naniar::miss_var_summary() %>% select(pct_miss)
hist(miss_cond_vars$pct_miss) #And the variables they're missing are missing 100% of the items
dim(df)
## [1] 598 624
#^Code above confirms everyone in dataset now was assigned to/completed a mood induction condition
#Hard to know for sure, but scrolling through this person's actual data file, it
#appears that they started the study and went through almost everything up to the
#mood induction. They were assigned neutral but didn't type anything and subsequently went on to
#complete the rest of the measures. Because they didn't do any of the condition writing,
#I'm not sure we could argue they would be from the same post-induction "population"
#as folks who were exposed to the condition. Opting to remove them.
df <- df %>% filter(!is.na(Condition))
sum(is.na(df$Condition))
## [1] 0
dim(df)
## [1] 597 624
dim(df)
## [1] 597 624
table(df$AUDIT1)
##
## Four or more times a week Monthly or less Never
## 22 171 169
## Two to four times a month Two to three times a week
## 129 106
df <- df %>% filter(AUDIT1 != "Never")
#### Missingness in Substance Use Data ####
Missing_Demo_df <- Demo_df %>% filter(anyNA(.)) %>% arrange(ID)
vis_miss(Missing_Demo_df)
## Warning: `gather_()` was deprecated in tidyr 1.2.0.
## Please use `gather()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
Demo_Total_Table
## Warning: The `fmt_missing()` function is deprecated and will soon be removed
## * Use the `sub_missing()` function instead
| Characteristic | Full Sample | By Condition | ||
|---|---|---|---|---|
| N = 4281 | Negative, N = 1391 | Neutral, N = 1491 | Positive, N = 1401 | |
| Age | M(SD)=19.49(1.93) | M(SD)=19.70(2.18) | M(SD)=19.52(1.82) | M(SD)=19.25(1.75) |
| Sex-at-Birth | ||||
| Female | 247 (58%) | 75 (54%) | 100 (67%) | 72 (51%) |
| Male | 181 (42%) | 64 (46%) | 49 (33%) | 68 (49%) |
| Gender | ||||
| Female | 248 (58%) | 75 (54%) | 101 (68%) | 72 (51%) |
| Male | 179 (42%) | 63 (45%) | 48 (32%) | 68 (49%) |
| Non-binary | 1 (0.2%) | 1 (0.7%) | 0 (0%) | 0 (0%) |
| Sexual Orientation | ||||
| Asexual | 3 (0.7%) | 2 (1.4%) | 1 (0.7%) | 0 (0%) |
| Bisexual | 22 (5.1%) | 3 (2.2%) | 8 (5.4%) | 11 (7.9%) |
| Heterosexual | 391 (91%) | 130 (94%) | 136 (91%) | 125 (89%) |
| Homosexual | 12 (2.8%) | 4 (2.9%) | 4 (2.7%) | 4 (2.9%) |
| Race/Ethnicity | ||||
| American Indian or Alaska Native | 5 (1.2%) | 2 (1.4%) | 3 (2.0%) | 0 (0%) |
| Asian | 8 (1.9%) | 1 (0.7%) | 5 (3.4%) | 2 (1.4%) |
| Black or African American | 19 (4.5%) | 6 (4.3%) | 7 (4.7%) | 6 (4.3%) |
| Hispanic or Latino | 30 (7.0%) | 10 (7.2%) | 10 (6.7%) | 10 (7.2%) |
| Middle Eastern | 2 (0.5%) | 0 (0%) | 1 (0.7%) | 1 (0.7%) |
| Multiracial | 10 (2.3%) | 4 (2.9%) | 4 (2.7%) | 2 (1.4%) |
| White (non-Hispanic) | 352 (83%) | 116 (83%) | 119 (80%) | 117 (85%) |
| Student Status | ||||
| Yes | 428 (100%) | 139 (100%) | 149 (100%) | 140 (100%) |
| Student Year | ||||
| Freshman | 241 (56%) | 71 (51%) | 80 (54%) | 90 (64%) |
| Junior | 46 (11%) | 14 (10%) | 21 (14%) | 11 (7.9%) |
| Senior | 39 (9.1%) | 18 (13%) | 12 (8.1%) | 9 (6.4%) |
| Sophomore | 102 (24%) | 36 (26%) | 36 (24%) | 30 (21%) |
| 1 M(SD)=Mean(SD); n (%) | ||||
Demo_Chi_df %>% left_join(Demo_Chi_Stat, by = "Variable") %>% left_join(Demo_Chi_p, by = "Variable") %>% arrange(p_value)
## # A tibble: 8 × 4
## Variable df `Chi_Square/F_Value` p_value
## <chr> <int> <dbl> <dbl>
## 1 SAB.f 2 8.46 0.0145
## 2 Gender.f 4 11.2 0.0244
## 3 Marital_Status.f 6 11.4 0.0758
## 4 Student_Year.f 6 9.27 0.159
## 5 Sexual_Orientation.f 6 6.64 0.355
## 6 Employment.f 6 5.93 0.431
## 7 Native_Language.f 6 4.87 0.561
## 8 Race_Ethnicity.f 12 7.44 0.827
#Anova assessing Age differences according to condition
summary(aov(Age ~ Condition, Demo_df))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 2 14.5 7.242 1.961 0.142
## Residuals 424 1566.2 3.694
## 1 observation deleted due to missingness
Drug_df %>% vis_miss()
Drug_Total_Table
## Warning: The `fmt_missing()` function is deprecated and will soon be removed
## * Use the `sub_missing()` function instead
| Characteristic | Full Sample | By Condition | ||
|---|---|---|---|---|
| N = 4281 | Negative, N = 1391 | Neutral, N = 1491 | Positive, N = 1401 | |
| Drinking Frequency | ||||
| Never | 0 (0%) | 0 (0%) | 0 (0%) | 0 (0%) |
| Monthly or less | 171 (40%) | 65 (47%) | 58 (39%) | 48 (34%) |
| 2-4x/month | 129 (30%) | 33 (24%) | 48 (32%) | 48 (34%) |
| 2-3x/week | 106 (25%) | 32 (23%) | 38 (26%) | 36 (26%) |
| 4+ x/week | 22 (5.1%) | 9 (6.5%) | 5 (3.4%) | 8 (5.7%) |
| Drinking Quantity | ||||
| 1-2 | 150 (35%) | 53 (38%) | 56 (38%) | 41 (29%) |
| 3-4 | 148 (35%) | 44 (32%) | 53 (36%) | 51 (36%) |
| 5-6 | 81 (19%) | 28 (20%) | 29 (19%) | 24 (17%) |
| 7-9 | 40 (9.3%) | 12 (8.6%) | 8 (5.4%) | 20 (14%) |
| 10+ | 9 (2.1%) | 2 (1.4%) | 3 (2.0%) | 4 (2.9%) |
| Binge Drinking Frequency | ||||
| Never | 155 (36%) | 49 (35%) | 63 (42%) | 43 (31%) |
| < Monthly | 141 (33%) | 49 (35%) | 46 (31%) | 46 (33%) |
| Monthly | 77 (18%) | 23 (17%) | 27 (18%) | 27 (19%) |
| Weekly | 54 (13%) | 17 (12%) | 13 (8.7%) | 24 (17%) |
| Daily or ~Daily | 1 (0.2%) | 1 (0.7%) | 0 (0%) | 0 (0%) |
| AUDIT Total | M(SD)=6.5(5.2) | M(SD)=6.4(5.0) | M(SD)=6.0(5.0) | M(SD)=7.2(5.4) |
| DUDIT_Total | M(SD)=2.4(4.6) | M(SD)=2.2(4.6) | M(SD)=2.6(5.4) | M(SD)=2.4(3.8) |
| AUD Criteria Endorsed | M(SD)=2.10(2.14) | M(SD)=1.96(2.07) | M(SD)=2.18(2.30) | M(SD)=2.16(2.06) |
| SUD Criteria Endorsed | M(SD)=1.28(2.26) | M(SD)=0.95(1.69) | M(SD)=1.35(2.44) | M(SD)=1.52(2.53) |
| AUD Diagnostic Status | ||||
| Mild | 126 (29%) | 29 (21%) | 41 (28%) | 56 (40%) |
| Moderate | 66 (15%) | 25 (18%) | 24 (16%) | 17 (12%) |
| None | 203 (47%) | 76 (55%) | 71 (48%) | 56 (40%) |
| Severe | 33 (7.7%) | 9 (6.5%) | 13 (8.7%) | 11 (7.9%) |
| SUD Diagnostic Status | ||||
| Mild | 62 (14%) | 16 (12%) | 18 (12%) | 28 (20%) |
| Moderate | 28 (6.5%) | 12 (8.6%) | 10 (6.7%) | 6 (4.3%) |
| None | 312 (73%) | 108 (78%) | 110 (74%) | 94 (67%) |
| Severe | 26 (6.1%) | 3 (2.2%) | 11 (7.4%) | 12 (8.6%) |
| 1 n (%); M(SD)=Mean(SD) | ||||
Drug_Chi_df %>% left_join(Drug_Chi_Stat, by = "Variable") %>% left_join(Drug_Chi_p, by = "Variable") %>% arrange(p_value)
## # A tibble: 7 × 4
## Variable df `Chi_Square/F_Value` p_value
## <chr> <int> <dbl> <dbl>
## 1 MINI_AUD_Dx 6 14.2 0.0272
## 2 MINI_SUD_Dx 6 12.9 0.0452
## 3 Favorite_Caff.f 8 9.91 0.271
## 4 AUDIT2.f 8 9.80 0.280
## 5 AUDIT1.f 6 7.43 0.283
## 6 AUDIT3.f 8 9.59 0.295
## 7 Favorite_Alcohol.f 6 3.82 0.701
rbind(AUDITSum_aov, DUDITSum_aov, MINIAUDSum_aov, MINISUDSum_aov) %>% arrange(p_value)
## Variable F_value df_n df_d p_value
## 1 MINI_SUD_Sum 2.3582996 2 425 0.09581754
## 2 AUDIT_Sum 2.0582221 2 425 0.12895159
## 3 MINI_AUD_Sum 0.4344687 2 425 0.64789596
## 4 DUDIT_Sum 0.2091036 2 425 0.81139458
table(Drug_df$AUDIT1.f, Drug_df$MINI_AUD_Sum)
##
## 0 1 2 3 4 5 6 7 8 9 11
## Never 0 0 0 0 0 0 0 0 0 0 0
## Monthly or less 96 34 19 14 4 4 0 0 0 0 0
## 2-4x/month 26 25 33 18 15 4 2 2 4 0 0
## 2-3x/week 7 13 19 18 20 8 9 5 5 2 0
## 4+ x/week 1 1 4 1 6 5 1 0 1 1 1
table(Drug_df$AUDIT1.f, Drug_df$MINI_AUD_Dx)
##
## Mild Moderate None Severe
## Never 0 0 0 0
## Monthly or less 33 8 130 0
## 2-4x/month 51 19 51 8
## 2-3x/week 37 28 20 21
## 4+ x/week 5 11 2 4
table(Drug_df$AUDIT2.f, Drug_df$MINI_AUD_Sum)
##
## 0 1 2 3 4 5 6 7 8 9 11
## 1-2 100 25 14 5 3 1 0 1 0 1 0
## 3-4 19 35 37 28 14 7 4 3 1 0 0
## 5-6 5 11 17 14 12 7 5 3 4 2 1
## 7-9 6 2 5 3 13 5 2 0 4 0 0
## 10+ 0 0 2 1 3 1 1 0 1 0 0
table(Drug_df$AUDIT2.f, Drug_df$MINI_AUD_Dx)
##
## Mild Moderate None Severe
## 1-2 19 4 125 2
## 3-4 65 21 54 8
## 5-6 31 19 16 15
## 7-9 8 18 8 6
## 10+ 3 4 0 2
T_dataframe
## Variable T_stat T_df T_p_value T_Mdiff
## t Negative 11.417252 138 1.136635e-21 2.3453237
## t1 Neutral -3.710182 148 2.924186e-04 -0.6644295
## t2 Positive -9.287051 139 2.901962e-16 -1.6000000
#Means and SD for each mood induction
Mood_df %>%
group_by(Condition) %>%
select(AG1_Valence, AG2_Valence) %>%
summarise_all(list(M = mean, SD = sd))
## Adding missing grouping variables: `Condition`
## # A tibble: 3 × 5
## Condition AG1_Valence_M AG2_Valence_M AG1_Valence_SD AG2_Valence_SD
## <fct> <dbl> <dbl> <dbl> <dbl>
## 1 Negative 5.71 3.36 2.05 2.07
## 2 Neutral 5.79 6.46 2.10 1.98
## 3 Positive 5.39 6.99 2.00 1.87
Mood_df %>%
group_by(Condition) %>%
summarise(SD_Ratio = sd(AG1_Valence)/sd(AG2_Valence), #Ratios around 1 suggest most rapid decline in change #score reliability per Gollwitzer et al. (2014)
Cor_Ratio = cor(AG1_Valence, AG2_Valence)) #Lower correlations suggest higher reliability coefficients per Gollwitzer et al. (2014)
## # A tibble: 3 × 3
## Condition SD_Ratio Cor_Ratio
## <fct> <dbl> <dbl>
## 1 Negative 0.991 0.308
## 2 Neutral 1.06 0.426
## 3 Positive 1.07 0.448
glimpse(UPPSP_df)
## Rows: 428
## Columns: 66
## $ ID <int> 23, 24, 27, 28, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, …
## $ Condition <fct> Neutral, Negative, Neutral, Negative, Negative, Neutral, Neg…
## $ UPPS_P_1 <dbl> 2, 3, 1, 1, 2, 2, 2, 2, 3, 1, 3, 4, 4, 4, 4, 2, 1, 4, 2, 2, …
## $ UPPS_P_2 <dbl> 2, 1, 2, 1, 2, 3, 1, 2, 1, 1, 1, 1, 2, 1, 4, 2, 2, 2, 2, 4, …
## $ UPPS_P_3 <dbl> 4, 3, 1, 3, 4, 4, 4, 3, 4, 3, 3, 4, 4, 3, 4, 3, 3, 4, 2, 3, …
## $ UPPS_P_4 <dbl> 1, 1, 1, 4, 3, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 3, 2, 4, …
## $ UPPS_P_5 <dbl> 1, 1, 1, 4, 2, 1, 1, 3, 1, 1, 2, 1, 2, 2, 4, 1, 1, 2, 1, 2, …
## $ UPPS_P_6 <dbl> 2, 1, 1, 3, 1, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 1, 2, …
## $ UPPS_P_7 <dbl> 3, 1, 3, 3, 3, 3, 1, 1, 2, 1, 3, 3, 4, 2, 4, 3, 3, 3, 3, 3, …
## $ UPPS_P_8 <dbl> 3, 2, 1, 4, 2, 4, 3, 2, 3, 3, 1, 4, 3, 3, 2, 3, 4, 4, 3, 3, …
## $ UPPS_P_9 <dbl> 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 3, …
## $ UPPS_P_10 <dbl> 2, 1, 1, 4, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 4, 1, 1, 3, 2, 2, …
## $ UPPS_P_11 <dbl> 1, 1, 2, 4, 4, 2, 3, 1, 2, 2, 2, 1, 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1, 2, 3, 3, 3, 4, 2, 3, 3, 2, 3, …
## $ UPPS_P_51 <dbl> 3, 4, 3, 1, 4, 4, 4, 4, 4, 3, 1, 4, 4, 4, 1, 3, 4, 4, 4, 4, …
## $ UPPS_P_52 <dbl> 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 1, 1, 4, 1, 2, 2, 1, 3, 1, 2, …
## $ UPPS_P_53 <dbl> 2, 2, 2, 2, 3, 3, 3, 2, 2, 1, 2, 2, 4, 1, 4, 2, 1, 2, 2, 3, …
## $ UPPS_P_54 <dbl> 2, 1, 1, 4, 2, 2, 1, 2, 1, 1, 2, 1, 3, 1, 4, 3, 1, 1, 3, 2, …
## $ UPPS_P_55 <dbl> 2, 2, 2, 3, 2, 2, 1, 2, 3, 1, 2, 2, 2, 1, 3, 2, 1, 3, 1, 3, …
## $ UPPS_P_56 <dbl> 4, 3, 2, 4, 4, 4, 3, 4, 2, 1, 3, 4, 3, 4, 4, 2, 4, 4, 4, 4, …
## $ UPPS_P_57 <dbl> 2, 3, 3, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 3, 4, 2, 3, 3, …
## $ UPPS_P_58 <dbl> 3, 1, 1, 2, 3, 3, 1, 2, 1, 2, 2, 3, 4, 2, 3, 3, 3, 3, 3, 3, …
## $ UPPS_P_59 <dbl> 2, 1, 1, 4, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 4, 3, 3, 3, 2, 2, …
## $ NU_Avg <dbl> 2.083333, 1.250000, 1.666667, 2.833333, 2.833333, 3.083333, …
## $ PU_Avg <dbl> 1.500000, 1.142857, 1.142857, 3.000000, 2.428571, 1.285714, …
## $ SS_Avg <dbl> 3.250000, 2.916667, 1.583333, 2.750000, 3.166667, 3.750000, …
## $ LoPM_Avg <dbl> 2.000000, 1.545455, 1.363636, 2.818182, 1.818182, 1.636364, …
## $ LoPER_Avg <dbl> 1.5, 1.4, 2.4, 2.3, 2.0, 2.1, 1.4, 1.6, 1.5, 1.4, 1.6, 1.1, …
UPPSP_df %>%
select(Condition, NU_Avg, PU_Avg) %>%
vis_miss()
UPPSP_df %>%
select(Condition, NU_Avg, PU_Avg) %>%
drop_na() %>%
group_by(Condition) %>%
summarise_all(list(M = mean, med = median, SD = sd))
## # A tibble: 3 × 7
## Condition NU_Avg_M PU_Avg_M NU_Avg_med PU_Avg_med NU_Avg_SD PU_Avg_SD
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Negative 2.32 1.91 2.33 1.93 0.603 0.549
## 2 Neutral 2.26 1.81 2.25 1.64 0.625 0.582
## 3 Positive 2.38 1.96 2.33 1.93 0.578 0.583
summary(aov(NU_Avg ~ Condition, UPPSP_df))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 2 0.86 0.4303 1.185 0.307
## Residuals 425 154.39 0.3633
summary(aov(PU_Avg ~ Condition, UPPSP_df))
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 2 1.67 0.8331 2.549 0.0794 .
## Residuals 424 138.59 0.3269
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
Demo_Drug_df <- left_join(Demo_df, Drug_df, by = c("ID", "Condition"))
Demo_Drug_Mood_df <- left_join(Demo_Drug_df, Mood_df, by = c("ID", "Condition"))
Full_df <- left_join(Demo_Drug_Mood_df, UPPSP_df, by = c("ID", "Condition"))
glimpse(Full_df)
## Rows: 428
## Columns: 94
## $ ID <int> 23, 24, 27, 28, 47, 48, 49, 50, 51, 52, 53, 54, 5…
## $ Condition <fct> Neutral, Negative, Neutral, Negative, Negative, N…
## $ Age <dbl> 22, 21, 21, 24, 20, 19, 19, 19, 20, 19, 19, 20, 2…
## $ SAB.f <fct> Female, Male, Female, Female, Male, Male, Female,…
## $ Gender.f <fct> Female, Male, Female, Non-binary, Male, Male, Fem…
## $ Sexual_Orientation.f <fct> Heterosexual, Heterosexual, Heterosexual, Asexual…
## $ Race_Ethnicity.f <fct> Hispanic or Latino, White (non-Hispanic), White (…
## $ Student_Status.f <fct> Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes,…
## $ Student_Year.f <fct> Senior, Junior, Senior, Senior, Sophomore, Freshm…
## $ Marital_Status.f <fct> Single, Single, Single, Married, Single, Single, …
## $ Employment.f <fct> Unemployed, Employed 1-20 hours per week, Employe…
## $ Native_Language.f <fct> English, English, English, English, English, Engl…
## $ AUDIT1.f <fct> 2-4x/month, Monthly or less, 2-3x/week, 2-4x/mont…
## $ AUDIT2.f <fct> 3-4, 1-2, 1-2, 3-4, 3-4, 3-4, 3-4, 5-6, 1-2, 1-2,…
## $ AUDIT3.f <fct> < Monthly, Never, < Monthly, < Monthly, Never, Mo…
## $ AUDIT_Sum <dbl> 6, 1, 6, 14, 3, 10, 4, 9, 1, 1, 3, 7, 8, 2, 20, 1…
## $ DUDIT_Sum <dbl> 0, 9, 4, 24, 0, 3, 0, 0, 0, 0, 0, 3, 3, 0, 1, 0, …
## $ MINI_AUD_Sum <dbl> 7, 0, 9, 6, 1, 1, 1, 3, 0, 0, 2, 4, 4, 2, 7, 0, 1…
## $ MINI_SUD_Sum <dbl> 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 3, 0, 3, 0, 5…
## $ MINI_AUD_Dx <fct> Severe, None, Severe, Severe, None, None, None, M…
## $ MINI_SUD_Dx <fct> None, None, None, None, None, None, None, None, N…
## $ Date_Last_Drank <date> 2020-03-25, 2020-03-31, 2020-03-31, 1901-01-01, …
## $ Favorite_Alcohol.f <fct> Wine, Beer, Wine, Beer, Liquor/Spirits, Beer, Liq…
## $ Favorite_Caff.f <fct> Coffee, Coffee, Coffee, Coffee, Coffee, Tea, Coff…
## $ AG1 <dbl> 16, 42, 73, 77, 61, 62, 59, 60, 52, 60, 52, 62, 5…
## $ AG2 <dbl> 41, 40, 73, 73, 56, 35, 41, 29, 52, 21, 62, 68, 3…
## $ AG1_Valence <dbl> 7, 6, 1, 5, 7, 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 2, 4…
## $ UPPS_P_57 <dbl> 2, 3, 3, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 3, 4…
## $ UPPS_P_58 <dbl> 3, 1, 1, 2, 3, 3, 1, 2, 1, 2, 2, 3, 4, 2, 3, 3, 3…
## $ UPPS_P_59 <dbl> 2, 1, 1, 4, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 4, 3, 3…
## $ NU_Avg <dbl> 2.083333, 1.250000, 1.666667, 2.833333, 2.833333,…
## $ PU_Avg <dbl> 1.500000, 1.142857, 1.142857, 3.000000, 2.428571,…
## $ SS_Avg <dbl> 3.250000, 2.916667, 1.583333, 2.750000, 3.166667,…
## $ LoPM_Avg <dbl> 2.000000, 1.545455, 1.363636, 2.818182, 1.818182,…
## $ LoPER_Avg <dbl> 1.5, 1.4, 2.4, 2.3, 2.0, 2.1, 1.4, 1.6, 1.5, 1.4,…
Full_df %>%
select(NU_Avg, PU_Avg, MINI_AUD_Sum, AUDIT_Sum, AG1_Valence, AG2_Valence) %>%
PerformanceAnalytics::chart.Correlation()
#Full_df %>% write_csv("/Users/noahwolkowicz/Desktop/CT/West Haven/Postdoc/Postdoc Research/Jenn & Noah #Collab/Data/JN_Collab_6.22.22.csv")