Removed the participants who 1) took less than 15 minutes to complete the survey, and 2) responded that they like “seeing a mouse in their house”/like “being late for an important date”/like “the smell of garbage”/dislike “going on vacation”
Abbreviations: BAS = body appreciation score; BAScat = body appreciation score category, by median; CR = cognitive restraint; CRcat = cognitive restraint, by tertiles; EBs = eating behaviors; EM = emotional eating; EMcat = emotional eating category, by tertiles; SFBL = sweet foods and beverages liking; SFBLcat = sweet foods and beverages liking, by tertiles; sHEI = health eating index; UE = uncontrolled eating; UEcat = uncontrolled eating category, by tertiles; UHF = unhealthy fat liking; UHFcat = unhealthy fat liking, by tertiles
Code
pacman::p_load(corrplot, MASS, readxl, writexl, ggsci, ggpubr, ggrepel, msm, ltm, ppcor, nnet, rstatix, FactoMineR, factoextra, purrr, multcomp, tidyr, GGally, ggcorrplot, ppcor, tidyverse)## load surveys setwd("/Users/maycheung/Documents/R/SNL_R/Data") ## Please note that you will need to set the working directory based on where your data is stored on your computerEB.survey.df <-read_excel("EB.qualtrics_29MAY25.xlsx")SL.survey.df <-read_excel("SL.qualtrics_29MAY25.xlsx")## join surveyscommon_cols <-intersect(names(EB.survey.df), names(SL.survey.df))EB.survey.df <- EB.survey.df %>%select(all_of(common_cols))SL.survey.df <- SL.survey.df %>%select(all_of(common_cols))survey.df <-bind_rows(EB.survey.df, SL.survey.df)survey.df <- survey.df %>%filter(!row_number() %in%1) %>%mutate(across(-c("DM-05", "DM-05_7_TEXT", "DM-06"), as.numeric)) %>%filter(Duration >720) %>%filter("FL-61_3">=0|"FL-62_3">=0|"FL-65_3"<=0|"FL-66_3">=0 ) %>%rename(age ="DM-01", height ="DM-02", weight ="DM-03", sex ="DM-04", race ="DM-05", orace ="DM-05_7_TEXT", ethn ="DM-06", usb ="DM-07", education ="DM-09", pinc ="DM-10", hinc ="DM-11", exec ="DM-12", smoke ="DM-13", diag ="DM-14") %>%mutate(usb =case_when( usb ==1~"U.S. Born", usb ==2~"Immigrant")) %>%mutate(race =case_when(str_detect(race, ",") ~"Mixed/Other", race ==1& ethn ==2~"African", race ==2& ethn ==2~"Mixed/Other", race ==3& ethn ==2~"Asian", race ==4& ethn ==2~"European", race ==5& ethn ==2~"NorAfrican", race ==6& ethn ==2~"Islander", race ==7& ethn ==2~"Mixed/Other", race >=1& ethn ==1~"Hispanic")) survey.df <- survey.df %>%rownames_to_column(., var ="ID") %>%filter(sex ==2)
Decoding survey
All scores and dietary intake estimates are calculated in this section
# A tibble: 12 × 2
group n
<chr> <int>
1 African Immigrant 47
2 African U.S. Born 95
3 Asian Immigrant 62
4 Asian U.S. Born 66
5 European Immigrant 7
6 European U.S. Born 29
7 Hispanic Immigrant 13
8 Hispanic U.S. Born 19
9 Mixed/Other Immigrant 3
10 Mixed/Other U.S. Born 11
11 NorAfrican Immigrant 4
12 NorAfrican U.S. Born 11
Code
## Counts - by agefull.df %>%group_by(agecat) %>%count()