Closed ben-domingue closed 1 month ago
working on this
Codebook: https://osf.io/5n9aj
Study 1: to achieve maximum validity with the fewest number of items, an empirical analysis was used to select a set of six items with high discrimination that incorporated multiple types of response-option formats Study 2: the scale’s unidimensional factor structure and high discrimination were confirmed, and the new scale outperformed several existing types of well-being scales in its ability to explain unique variance in health behavior criterion variables.
Processed data: EWAS_Sanford_2024_Study1.csv EWAS_Sanford_2024_Study2.csv
Code:
library(haven)
library(dplyr)
library(labelled)
library(tidyr)
# study 1
df <- read_sav("2024 Sanford EWAS Study 1.sav")
df$id <- seq(1, nrow(df))
df <- remove_labels(df)
df <- df %>%
select(id, Mea1, Mea2, Mea3, Mea4, Mea5, Mea6, Sat1, Sat2, Sat3, Sat4,
Sat5, Sat6, Enri1, Enri2, Enri3, Enri4, Enri5, Enri6, Enga1, Enga2,
Enga3, Enga4, Enga5, Enga6, Prod1, Prod2, Prod3, Prod4, Prod5, Prod6) %>%
mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%
pivot_longer(c(Mea1, Mea2, Mea3, Mea4, Mea5, Mea6, Sat1, Sat2, Sat3, Sat4,
Sat5, Sat6, Enri1, Enri2, Enri3, Enri4, Enri5, Enri6, Enga1, Enga2,
Enga3, Enga4, Enga5, Enga6, Prod1, Prod2, Prod3, Prod4, Prod5, Prod6),
names_to = "item",
values_to = "resp") %>%
filter(!is.na(resp))
# study 2
df2 <- read_sav("2024 Sanford EWAS Study 2.sav")
df2$id <- seq(1, nrow(df2))
df2 <- remove_labels(df2)
df2 <- df2 %>%
select(id, prod1, enri2, enga3, sat1, mea2, enri3, Flourish1, Flourish2, Flourish3,
Flourish4, Flourish5, Flourish6, Flourish7, Flourish8) %>%
mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%
pivot_longer(c(prod1, enri2, enga3, sat1, mea2, enri3, Flourish1, Flourish2, Flourish3,
Flourish4, Flourish5, Flourish6, Flourish7, Flourish8),
names_to = "item",
values_to = "resp") %>%
filter(!is.na(resp))
write.csv(df, "EWAS_Sanford_2024_Study1.csv", row.names=FALSE)
write.csv(df2, "EWAS_Sanford_2024_Study2.csv", row.names=FALSE)
the authors write
Participants in Study 1 completed a pool of 30 well-being appraisal items, and results from Study 1 were used to select a set of six items for the final version of the Everyday Wellbeing Appraisal Scale, which was then completed by participants in Study 2
i can see the 30 items in study 1. i then see the 6 items repeated in study 2 along with the flourishing items. what i would be inclined to do is:
tolower
or something similar) and then just have a study
column with 1 or 2. that make sense @saviranadela
totally make sense!
Processed data: EWAS_Sanford_2024_Flourish.csv EWAS_Sanford_2024.csv
Code:
library(haven)
library(dplyr)
library(labelled)
library(tidyr)
# study 1
df <- read_sav("2024 Sanford EWAS Study 1.sav")
df$id <- seq(1, nrow(df))
df <- remove_labels(df)
df <- df %>%
select(id, Mea1, Mea2, Mea3, Mea4, Mea5, Mea6, Sat1, Sat2, Sat3, Sat4,
Sat5, Sat6, Enri1, Enri2, Enri3, Enri4, Enri5, Enri6, Enga1, Enga2,
Enga3, Enga4, Enga5, Enga6, Prod1, Prod2, Prod3, Prod4, Prod5, Prod6) %>%
mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%
pivot_longer(c(Mea1, Mea2, Mea3, Mea4, Mea5, Mea6, Sat1, Sat2, Sat3, Sat4,
Sat5, Sat6, Enri1, Enri2, Enri3, Enri4, Enri5, Enri6, Enga1, Enga2,
Enga3, Enga4, Enga5, Enga6, Prod1, Prod2, Prod3, Prod4, Prod5, Prod6),
names_to = "item",
values_to = "resp") %>%
filter(!is.na(resp)) %>%
mutate(item = tolower(item))
df$study <- 1
#study 2
df2 <- read_sav("2024 Sanford EWAS Study 2.sav")
df2$id <- seq(1, nrow(df2))
df2 <- remove_labels(df2)
df2 <- df2 %>%
select(id, prod1, enri2, enga3, sat1, mea2, enri3) %>%
mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%
pivot_longer(c(prod1, enri2, enga3, sat1, mea2, enri3),
names_to = "item",
values_to = "resp") %>%
filter(!is.na(resp))
df2$study <- 2
df_comb <- bind_rows(df, df2)
# dff <- df_comb %>% filter(study == 1)
# print(dff)
# study 2 - flourish
dffl <- read_sav("2024 Sanford EWAS Study 2.sav")
dffl$id <- seq(1, nrow(dffl))
dffl <- remove_labels(dffl)
dffl <- dffl %>%
select(id, Flourish1, Flourish2, Flourish3,
Flourish4, Flourish5, Flourish6, Flourish7, Flourish8) %>%
mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%
pivot_longer(c(Flourish1, Flourish2, Flourish3,
Flourish4, Flourish5, Flourish6, Flourish7, Flourish8),
names_to = "item",
values_to = "resp") %>%
filter(!is.na(resp)) %>%
mutate(item = tolower(item))
write.csv(df_comb, "EWAS_Sanford_2024.csv", row.names=FALSE)
write.csv(dffl, "EWAS_Sanford_2024_Flourish.csv", row.names=FALSE)
please let me know if this is good to go so I can create the PR :) thanks!
@saviranadela looks good! ship the PR
https://osf.io/4td6k/