cleaning out ineligible participants
df.prefrosh2022 = df.prefrosh2022.deid %>%
filter(age18 == 1) %>%
group_by(PID) %>%
slice(1)
#removing participants who had more than half NA's
# For Fall 2022 we didn't get amazing participation so I commented out this line
#df.prefrosh2022 <- df.prefrosh2022[rowSums(is.na(df.prefrosh2022)) < 55,]
reverse-scored items
#reverse-scored items: LayEmpathy_3, TIPI_Criti, TIPI_Anx, TIPI_Reserv, TIPI_Disorg, TIPI_Conven, TAI_1, TAI_3, TAI_6, TAI_7, TAI_10, TAI_13, TAI_14, TAI_16, TAI_19, NeedToBelong_2, LifeSatisfaction_6, CESD_5, CESD__8, loneliness_3, and loneliness_6.
df.prefrosh2022 <- df.prefrosh2022 %>%
mutate(LifeSatisfaction_7R = 8 - LifeSatisfaction_7R,
LayEmpathy_3R = 8 - LayEmpathy_3R,
TIPI_Criti_R = 8 - TIPI_Criti_R,
TIPI_Anx_R = 8 - TIPI_Anx_R,
TIPI_Reserv_R = 8 - TIPI_Reserv_R,
TIPI_Disorg_R = 8 - TIPI_Disorg_R,
TIPI_Conven_R = 8 - TIPI_Conven_R,
CESD_4R = 5 - CESD_4R,
CESD_6R = 5 - CESD_6R,
loneliness_3R = 6 - loneliness_3R,
loneliness_6R = 6 - loneliness_6R)
mean/sum scores
df.prefrosh2022 <- df.prefrosh2022 %>%
rowwise() %>%
mutate(layEmpathy = mean(c(LayEmpathy_1,
LayEmpathy_2,
LayEmpathy_3R)),
extraversion = mean(c(TIPI_Extra,
TIPI_Reserv_R)),
agreeableness = mean(c(TIPI_Criti_R,
TIPI_Symp)),
conscientiousness = mean(c(TIPI_Depen,
TIPI_Disorg_R)),
emotionalStability = mean(c(TIPI_Anx_R,
TIPI_EmoSta)),
openToExperience = mean(c(TIPI_Open,
TIPI_Conven_R)),
stress = mean(c(Stress_1,
Stress_2)),
TAI = sum(c(TAI_7,
TAI_8,
TAI_15,
TAI_16,
TAI_18)),
EROS = mean(c(EROS1_1,
Empathy_10,
EROS1_6,
EROS1_7,
Empathy_6,
EROS1_9)),
Satwithlife = mean(c(LifeSatisfaction_3,
LifeSatisfaction_4,
LifeSatisfaction_1,
LifeSatisfaction_6,
LifeSatisfaction_9)),
loneliness = mean(c(loneliness_1,
loneliness_2,
loneliness_3R,
loneliness_4,
loneliness_5,
loneliness_6R,
loneliness_7,
loneliness_8)),
CESD = sum(c(CESD_1,
CESD_2,
NegativeWellBeing_1,
CESD_3,
CESD_4R,
NegativeWellBeing_10,
CESD_6R,
CESD_7,
CESD_8)),
ideo = mean(c(PoliIdeology_general,
PoliIdeology_social,
PoliIdeology_economic))) %>%
ungroup()
write csv
#write.csv(df.prefrosh2022, "~/Google Drive/Shared drives/Stanford Communities Project/2022-2023/MASTER/Prefrosh_survey/Fall 2022/df.prefrosh2022_1_10.csv", row.names = F)