Init

library(kirkegaard)
load_packages(
  tidyverse,
  psych
)

theme_set(theme_bw())

options(
    digits = 3
)

#multithreading
#library(future)
#plan(multisession(workers = 8))

Functions

Data

d <- read.csv("data/osfstorage-archive/1_WCHS.csv", header = TRUE)

# Apply exclusions (per Pratt et al., 2026)
d <- d %>%
  filter(Consent == 1) %>%
  filter(Progress == 100) %>%
  mutate(Q_RecaptchaScore = as.numeric(as.character(Q_RecaptchaScore))) %>%
  filter(is.na(Q_RecaptchaScore) | Q_RecaptchaScore >= 0.5) %>%
  filter(EnglishFluency >= 3) %>%
  filter(CorrectAttentionChecks >= 2)

# Score WCHS via single-factor ML extraction
wchs_items <- d %>% select(WCHS_1:WCHS_10)
fa_mod <- fa(wchs_items, nfactors = 1, rotate = "oblimin", fm = "ml")
d$WCHS_fa <- as.numeric(scale(factor.scores(wchs_items, fa_mod, method = "regression")$scores))

# Recode demographics and other variables (from original code)
d$SES[d$SES == 7] <- NA
d$subjstatus <- 8 - d$subjstatus
d$Education[d$Education == 7] <- NA
d$religdummy <- ifelse(d$Religion %in% 1:2, 0, ifelse(d$Religion %in% 3:7, 1, NA))
d$partydummy <- ifelse(d$PartyID == 1, 0, ifelse(d$PartyID == 2, 1, NA))
d$PoliticalIdeology_reversed <- 8 - d$PoliticalIdeology

# Bifactor model for psychopathology (GAD-7, PHQ-9, DERS, ASI, BRS reversed, neuroticism)
gad_items <- paste0("GAD7_", 1:7)
phq_items <- paste0("PHQ9_", 1:9)
ders_items <- c("DERS_2", "DERS_3", "DERS_5", paste0("DERS_", 7:18))
brs_items <- c("BRS_1", "BRS_2R", "BRS_3", "BRS_4R", "BRS_5", "BRS_6R")
asi_items <- paste0("ASI_", 1:16)
neuro_items <- c("TIPI_4R_ES", "TIPI_9_ES")

psych_data <- d[, c(gad_items, phq_items, ders_items, asi_items, brs_items, neuro_items)]
psych_data[, brs_items] <- 6 - psych_data[, brs_items]  # reverse so higher = more pathology
psych_data$TIPI_9_ES <- 8 - psych_data$TIPI_9_ES        # reverse so higher = more neurotic

# Fit bifactor CFA via lavaan (omega_h = .86, ECV = .63)
library(lavaan)
psych_cc <- psych_data[complete.cases(psych_data), ]
all_items_psych <- colnames(psych_cc)

bifactor_model <- paste0(
  "g =~ ", paste(all_items_psych, collapse = " + "), "\n",
  "F_anx_dep =~ ", paste(all_items_psych[grep("GAD7|PHQ9", all_items_psych)], collapse = " + "), "\n",
  "F_anx_sens =~ ", paste(all_items_psych[grep("ASI", all_items_psych)], collapse = " + "), "\n",
  "F_resil =~ ", paste(all_items_psych[grep("BRS|TIPI", all_items_psych)], collapse = " + "), "\n",
  "F_dysreg =~ ", paste(all_items_psych[grep("DERS", all_items_psych)], collapse = " + "), "\n"
)

fit_bi <- cfa(bifactor_model, data = psych_cc, orthogonal = TRUE, estimator = "MLR", std.lv = TRUE)
scores_bi <- scale(lavPredict(fit_bi))

cc <- complete.cases(psych_data)
d$psychopathology <- NA_real_; d$psychopathology[cc] <- scores_bi[, "g"]
d$anx_dep <- NA_real_; d$anx_dep[cc] <- scores_bi[, "F_anx_dep"]
d$anx_sensitivity <- NA_real_; d$anx_sensitivity[cc] <- scores_bi[, "F_anx_sens"]
d$resilience <- NA_real_; d$resilience[cc] <- scores_bi[, "F_resil"]
d$dysregulation <- NA_real_; d$dysregulation[cc] <- scores_bi[, "F_dysreg"]

Analysis

Sex difference

d_sex <- d %>%
  filter(Gender %in% c(1, 2)) %>%
  mutate(Sex = factor(Gender, levels = c(1, 2), labels = c("Male", "Female")))

# Cohen's d (Female - Male)
m <- tapply(d_sex$WCHS_fa, d_sex$Sex, mean, na.rm = TRUE)
s <- tapply(d_sex$WCHS_fa, d_sex$Sex, sd, na.rm = TRUE)
n <- tapply(d_sex$WCHS_fa, d_sex$Sex, length)
pooled_sd <- sqrt(((n["Male"]-1)*s["Male"]^2 + (n["Female"]-1)*s["Female"]^2) / (sum(n)-2))
cohen_d <- (m["Female"] - m["Male"]) / pooled_sd

p <- ggplot(d_sex, aes(x = Sex, y = WCHS_fa)) +
  geom_violin(aes(fill = Sex), alpha = 0.3, width = 0.7) +
  geom_boxplot(width = 0.15, outlier.shape = NA) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18) +
  scale_fill_manual(values = c("Male" = "steelblue", "Female" = "coral")) +
  labs(x = NULL, y = "WCHS (factor score)", title = "Words Can Harm Scale by Sex") +
  theme_bw() +
  theme(legend.position = "none") +
  annotate("text", x = 1.5, y = max(d_sex$WCHS_fa, na.rm = TRUE) * 0.95,
           label = sprintf("d = %.2f", cohen_d), size = 4.5)
p
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

ggsave("figs/wchs_sex_difference.png", p, width = 5, height = 5, dpi = 300)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

Race differences

d_race <- d %>%
  mutate(Race = as.character(Race),
         Race_single = ifelse(!grepl(",", Race) & Race %in% as.character(1:7), Race, NA),
         Race_grp = case_when(
           Race_single == "6" ~ "White",
           Race_single == "4" ~ "Black",
           Race_single == "2" ~ "Asian",
           Race_single == "7" ~ "Hispanic",
           TRUE ~ NA_character_
         )) %>%
  filter(!is.na(Race_grp))

race_order <- d_race %>% group_by(Race_grp) %>% summarise(m = mean(WCHS_fa, na.rm = TRUE)) %>% arrange(m)
d_race$Race_grp <- factor(d_race$Race_grp, levels = race_order$Race_grp)

race_stats <- d_race %>%
  group_by(Race_grp) %>%
  summarise(n = n(), m = mean(WCHS_fa, na.rm = TRUE), s = sd(WCHS_fa, na.rm = TRUE)) %>%
  mutate(label = sprintf("n=%d\nM=%.2f", n, m))

p <- ggplot(d_race, aes(x = Race_grp, y = WCHS_fa)) +
  geom_violin(aes(fill = Race_grp), alpha = 0.3, width = 0.7) +
  geom_boxplot(width = 0.15, outlier.shape = NA) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18) +
  geom_text(data = race_stats, aes(x = Race_grp, y = -3.3, label = label), size = 3.2) +
  labs(x = NULL, y = "WCHS (factor score, z)", title = "Words Can Harm Scale by Race") +
  theme_bw() +
  theme(legend.position = "none")
p
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

ggsave("figs/wchs_race_difference.png", p, width = 6, height = 5, dpi = 300)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

Age and sex

d_sex <- d %>%
  filter(Gender %in% c(1, 2)) %>%
  mutate(Sex = factor(Gender, levels = c(1, 2), labels = c("Male", "Female")))

p <- ggplot(d_sex, aes(x = Age, y = WCHS_fa, color = Sex)) +
  geom_point(alpha = 0.3, size = 1.5) +
  geom_smooth(method = "lm", se = TRUE) +
  scale_color_manual(values = c("Male" = "steelblue", "Female" = "coral")) +
  labs(x = "Age", y = "WCHS (factor score, z)", title = "Words Can Harm Scale by Age and Sex") +
  theme_bw()
p
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggsave("figs/wchs_age_sex.png", p, width = 7, height = 5, dpi = 300)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 2 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).

Psychopathology

r_val <- cor(d$WCHS_fa, d$psychopathology, use = "complete.obs")

p <- ggplot(d_sex, aes(x = psychopathology, y = WCHS_fa, color = Sex)) +
  geom_point(alpha = 0.3, size = 1.5) +
  geom_smooth(method = "lm", se = TRUE) +
  scale_color_manual(values = c("Male" = "steelblue", "Female" = "coral")) +
  labs(x = "General psychopathology (z)", y = "WCHS (factor score, z)",
       title = "Words Can Harm Scale vs. General Psychopathology") +
  annotate("text", x = -0.5, y = 1.9, label = sprintf("r = %.2f", r_val), size = 4.5) +
  theme_bw()
p
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggsave("figs/wchs_psychopathology.png", p, width = 7, height = 5, dpi = 300)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).

Political ideology

r_val <- cor(d$WCHS_fa, d$PoliticalIdeology_reversed, use = "complete.obs")

p <- ggplot(d_sex, aes(x = PoliticalIdeology_reversed, y = WCHS_fa, color = Sex)) +
  geom_jitter(alpha = 0.3, size = 1.5, width = 0.15) +
  geom_smooth(method = "lm", se = TRUE) +
  scale_color_manual(values = c("Male" = "steelblue", "Female" = "coral")) +
  scale_x_continuous(breaks = 1:7, labels = c("Very\ncons.", "Cons.", "Lean\ncons.", "Moderate", "Lean\nlib.", "Liberal", "Very\nlib.")) +
  labs(x = "Political ideology", y = "WCHS (factor score, z)",
       title = "Words Can Harm Scale vs. Political Ideology") +
  annotate("text", x = 2, y = 1.9, label = sprintf("r = %.2f", r_val), size = 4.5) +
  theme_bw()
p
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).

ggsave("figs/wchs_politics.png", p, width = 7, height = 5, dpi = 300)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 1 row containing non-finite outside the scale range (`stat_smooth()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).

Party affiliation

d_party <- d %>%
  filter(PartyID %in% 1:5) %>%
  mutate(Party = factor(PartyID, levels = c(1, 2, 3, 4, 5),
                        labels = c("Republican", "Democrat", "Independent", "Libertarian", "None")))

party_stats <- d_party %>%
  group_by(Party) %>%
  summarise(n = n(), m = mean(WCHS_fa, na.rm = TRUE)) %>%
  mutate(label = sprintf("n=%d\nM=%.2f", n, m))

party_order <- party_stats %>% arrange(m)
d_party$Party <- factor(d_party$Party, levels = party_order$Party)
party_stats$Party <- factor(party_stats$Party, levels = party_order$Party)

p <- ggplot(d_party, aes(x = Party, y = WCHS_fa)) +
  geom_violin(aes(fill = Party), alpha = 0.3, width = 0.7) +
  geom_boxplot(width = 0.15, outlier.shape = NA) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18) +
  geom_text(data = party_stats, aes(x = Party, y = -3.3, label = label), size = 3.2) +
  labs(x = NULL, y = "WCHS (factor score, z)", title = "Words Can Harm Scale by Party Affiliation") +
  theme_bw() +
  theme(legend.position = "none")
p
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

ggsave("figs/wchs_party.png", p, width = 7, height = 5, dpi = 300)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_summary()`).

Regression table

library(modelsummary)

# Standardized regression: progressive models predicting WCHS
d_reg <- d %>%
  filter(Gender %in% c(1, 2)) %>%
  mutate(
    female = as.numeric(Gender == 2),
    age = Age,
    leftism = PoliticalIdeology_reversed,
    Race = as.character(Race),
    Race_single = ifelse(!grepl(",", Race) & Race %in% as.character(1:7), Race, NA),
    race_grp = case_when(
      Race_single == "6" ~ "White",
      Race_single == "4" ~ "Black",
      Race_single == "2" ~ "Asian",
      Race_single == "7" ~ "Hispanic",
      TRUE ~ NA_character_
    )
  ) %>%
  filter(!is.na(race_grp)) %>%
  mutate(
    black = as.numeric(race_grp == "Black"),
    asian = as.numeric(race_grp == "Asian"),
    hispanic = as.numeric(race_grp == "Hispanic")
  ) %>%
  select(WCHS_fa, female, black, asian, hispanic, age, leftism, psychopathology,
         anx_dep, anx_sensitivity, resilience, dysregulation) %>%
  na.omit()

d_z <- as.data.frame(scale(d_reg))

m1 <- lm(WCHS_fa ~ age + female + black + asian + hispanic, data = d_z)
m2 <- lm(WCHS_fa ~ age + female + black + asian + hispanic + leftism, data = d_z)
m3 <- lm(WCHS_fa ~ age + female + black + asian + hispanic + leftism + psychopathology, data = d_z)
m4 <- lm(WCHS_fa ~ age + female + black + asian + hispanic + leftism + psychopathology + anx_sensitivity, data = d_z)
m5 <- lm(WCHS_fa ~ age + female + black + asian + hispanic + leftism + psychopathology + anx_sensitivity + anx_dep + resilience + dysregulation, data = d_z)

models <- list("M1" = m1, "M2" = m2, "M3" = m3, "M4" = m4, "M5" = m5)

cm <- c(
  "age" = "Age", "female" = "Female", "black" = "Black", "asian" = "Asian",
  "hispanic" = "Hispanic", "leftism" = "Leftism", "psychopathology" = "Psychopathology (P)",
  "anx_sensitivity" = "Anxiety sensitivity", "anx_dep" = "Anxiety/depression",
  "resilience" = "Resilience", "dysregulation" = "Dysregulation",
  "(Intercept)" = "(Intercept)"
)

gm <- list(
  list(raw = "adj.r.squared", clean = "Adj. R²", fmt = 3),
  list(raw = "nobs", clean = "N", fmt = 0)
)

tab <- modelsummary(
  models, stars = c("*" = 0.01, "**" = 0.001), coef_map = cm, gof_map = gm,
  title = "Predicting Words Can Harm Scale (standardized coefficients)",
  notes = "* p < .01, ** p < .001. All variables standardized. Race baseline = White.",
  output = "gt"
)
tab
Predicting Words Can Harm Scale (standardized coefficients)
M1 M2 M3 M4 M5
Age -0.072 -0.058 0.007 0.010 0.012
(0.034) (0.033) (0.035) (0.034) (0.034)
Female 0.187** 0.176** 0.173** 0.157** 0.150**
(0.034) (0.033) (0.032) (0.031) (0.032)
Black 0.189** 0.175** 0.183** 0.161** 0.172**
(0.034) (0.033) (0.033) (0.032) (0.033)
Asian -0.000 -0.004 -0.005 0.003 0.008
(0.034) (0.033) (0.032) (0.032) (0.032)
Hispanic 0.055 0.049 0.043 0.046 0.051
(0.035) (0.034) (0.033) (0.032) (0.032)
Leftism 0.244** 0.245** 0.256** 0.250**
(0.033) (0.032) (0.031) (0.032)
Psychopathology (P) 0.186** 0.171** 0.169**
(0.034) (0.033) (0.033)
Anxiety sensitivity 0.222** 0.217**
(0.031) (0.032)
Anxiety/depression 0.031
(0.032)
Resilience 0.009
(0.033)
Dysregulation -0.029
(0.033)
(Intercept) -0.000 -0.000 -0.000 -0.000 -0.000
(0.034) (0.033) (0.032) (0.031) (0.031)
Adj. R² 0.076 0.134 0.163 0.211 0.210
N 820 820 820 820 820
* p < 0.01, ** p < 0.001
* p < .01, ** p < .001. All variables standardized. Race baseline = White.
gt::gtsave(tab, "figs/regression_table.png")
## file:////tmp/Rtmp2XHBx6/file242b1573066258.html screenshot completed
# Partial epsilon squared (Type II SS)
library(car)
library(effectsize)
eps <- epsilon_squared(Anova(m5, type = 2), alternative = "two.sided")

label_map <- c(
  "age" = "Age", "female" = "Female", "black" = "Black", "asian" = "Asian",
  "hispanic" = "Hispanic", "leftism" = "Leftism", "psychopathology" = "Psychopathology (P)",
  "anx_sensitivity" = "Anxiety sensitivity", "anx_dep" = "Anxiety/depression",
  "resilience" = "Resilience", "dysregulation" = "Dysregulation"
)

eps_df <- data.frame(predictor = eps$Parameter, eps2 = eps$Epsilon2_partial, eps = sqrt(eps$Epsilon2_partial))
eps_df$label <- label_map[as.character(eps_df$predictor)]
eps_df <- eps_df %>% arrange(eps) %>% mutate(label = factor(label, levels = label))

p <- ggplot(eps_df, aes(x = label, y = eps)) +
  geom_col(fill = "steelblue", alpha = 0.7) +
  geom_text(aes(label = sprintf("%.2f", eps)), hjust = -0.2, size = 3.5) +
  coord_flip() +
  labs(x = NULL, y = expression(sqrt(partial~epsilon^2)),
       title = "Independent Effects on Words Can Harm Scale") +
  theme_bw() +
  ylim(0, max(eps_df$eps) * 1.15)
p

ggsave("figs/wchs_effect_sizes.png", p, width = 7, height = 5, dpi = 300)

Meta

#versions
write_sessioninfo()
## R version 4.5.2 (2025-10-31)
## Platform: x86_64-pc-linux-gnu
## Running under: Linux Mint 21.1
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0  LAPACK version 3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_DK.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_DK.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Europe/Brussels
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] effectsize_1.0.1      car_3.1-3             carData_3.0-5        
##  [4] modelsummary_2.5.0    lavaan_0.6-20         kirkegaard_2025-11-19
##  [7] robustbase_0.99-6     assertthat_0.2.1      weights_1.1.2        
## [10] magrittr_2.0.4        psych_2.5.6           mirt_1.45.1          
## [13] lattice_0.22-7        lubridate_1.9.4       forcats_1.0.1        
## [16] stringr_1.6.0         dplyr_1.1.4           purrr_1.2.0          
## [19] readr_2.1.5           tidyr_1.3.1           tibble_3.3.0         
## [22] ggplot2_4.0.1.9000    tidyverse_2.0.0      
## 
## loaded via a namespace (and not attached):
##   [1] splines_4.5.2      later_1.4.4        R.oo_1.27.1       
##   [4] datawizard_1.3.0   rpart_4.1.24       lifecycle_1.0.4   
##   [7] httr2_1.2.1        Rdpack_2.6.4       ellmer_0.4.0      
##  [10] processx_3.8.6     globals_0.18.0     MASS_7.3-65       
##  [13] insight_1.4.2      backports_1.5.0    sass_0.4.10       
##  [16] btw_1.1.0          Hmisc_5.2-4        rmarkdown_2.30    
##  [19] jquerylib_0.1.4    yaml_2.3.10        askpass_1.2.1     
##  [22] sessioninfo_1.2.3  chromote_0.5.1     pbapply_1.7-4     
##  [25] minqa_1.2.8        RColorBrewer_1.1-3 abind_1.4-8       
##  [28] multcomp_1.4-28    audio_0.1-11       quadprog_1.5-8    
##  [31] R.utils_2.13.0     coro_1.1.0         nnet_7.3-20       
##  [34] TH.data_1.1-4      webshot2_0.1.2     rappdirs_0.3.3    
##  [37] sandwich_3.1-1     listenv_0.9.1      gdata_3.0.1       
##  [40] testthat_3.2.3     vegan_2.7-2        performance_0.15.2
##  [43] parallelly_1.45.1  permute_0.9-8      codetools_0.2-20  
##  [46] xml2_1.4.0         tidyselect_1.2.1   shape_1.4.6.1     
##  [49] farver_2.1.2       lme4_1.1-37        base64enc_0.1-3   
##  [52] jsonlite_2.0.0     mitml_0.4-5        progressr_0.16.0  
##  [55] Formula_1.2-5      survival_3.8-6     iterators_1.0.14  
##  [58] emmeans_1.11.2-8   systemfonts_1.3.1  foreach_1.5.2     
##  [61] tools_4.5.2        ragg_1.5.0         Rcpp_1.1.0        
##  [64] glue_1.8.0         mnormt_2.1.1       gridExtra_2.3     
##  [67] pan_1.9            xfun_0.57          mcptools_0.2.0    
##  [70] mgcv_1.9-3         websocket_1.4.4    withr_3.0.2       
##  [73] beepr_2.0          fastmap_1.2.0      boot_1.3-32       
##  [76] fansi_1.0.6        openssl_2.3.4      digest_0.6.39     
##  [79] timechange_0.3.0   R6_2.6.1           estimability_1.5.1
##  [82] mice_3.18.0        textshaping_1.0.4  colorspace_2.1-2  
##  [85] gtools_3.9.5       R.methodsS3_1.8.2  utf8_1.2.6        
##  [88] generics_0.1.4     data.table_1.17.8  SimDesign_2.21    
##  [91] htmlwidgets_1.6.4  parameters_0.28.2  pkgconfig_2.0.3   
##  [94] gtable_0.3.6       rsconnect_1.5.1    lmtest_0.9-40     
##  [97] S7_0.2.1           brio_1.1.5         htmltools_0.5.8.1 
## [100] scales_1.4.0      
##  [ reached 'max' / getOption("max.print") -- omitted 47 entries ]
#write data to file for reuse
d %>% write_rds("data/data_for_reuse.rds")

#OSF
if (F) {
  library(osfr)
  
  #login
  osf_auth(readr::read_lines("~/.config/osf_token"))
  
  #the project we will use
  osf_proj = osf_retrieve_node("https://osf.io/XXX/")
  
  #upload all files in project
  #overwrite existing (versioning)
  osf_upload(
    osf_proj,
    path = c("data", "figures", "papers", "notebook.Rmd", "notebook.html", "sessions_info.txt"), 
    conflicts = "overwrite"
    )
}