library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(knitr)
study2 <- read_csv("Study 2.csv")
## Rows: 336 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): Gender, Ethnicity, Country
## dbl (14): Participant_ID, Age, T1Extraversion, T1SWLS, T2SWLS, SWLS_Diff, T1...
##
## ℹ 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.
study2meansd <- study2 %>%
summarise(
"T1 Life satisfaction" = paste(sprintf("%.2f", mean(T1SWLS)), "(", sprintf("%.2f", sd(T1SWLS)), ")"),
"T2 Life satisfaction" = paste(sprintf("%.2f", mean(T2SWLS)), "(", sprintf("%.2f", sd(T2SWLS)), ")"),
"Life Satisfaction change" = paste(sprintf("%.2f", mean(SWLS_Diff)), "(", sprintf("%.2f", sd(SWLS_Diff)), ")"),
"T1 Relatedness" = paste(sprintf("%.2f", mean(T1BMPN)), "(", sprintf("%.2f", sd(T1BMPN)), ")"),
"T2 Relatedness" = paste(sprintf("%.2f", mean(T2BMPN)), "(", sprintf("%.2f", sd(T2BMPN)), ")"),
"Relatedness Change" = paste(sprintf("%.2f", mean(BMPN_Diff)), "(", sprintf("%.2f", sd(BMPN_Diff)), ")"),
"T1 Loneliness" = paste(sprintf("%.2f", mean(T1Lonely)), "(", sprintf("%.2f", sd(T1Lonely)), ")"),
"T2 Loneliness" = paste(sprintf("%.2f", mean(T2Lonely)), "(", sprintf("%.2f", sd(T2Lonely)), ")"),
"Loneliness Change" = paste(sprintf("%.2f", mean(Lonely_Diff)), "(", sprintf("%.2f", sd(T1SWLS)), ")"),
"T1 Extraversion Change" = paste(sprintf("%.2f", mean(T1Extraversion)), "(", sprintf("%.2f", sd(T1Extraversion)), ")")
)
table3 <- as.data.frame(study2meansd)
rownames(table3) <- "Mean (SD)"
kable(table3)
| Mean (SD) |
3.97 ( 1.53 ) |
3.99 ( 1.45 ) |
0.02 ( 0.88 ) |
4.92 ( 1.09 ) |
4.91 ( 1.14 ) |
-0.01 ( 1.11 ) |
2.12 ( 0.65 ) |
2.06 ( 0.62 ) |
-0.06 ( 1.53 ) |
3.90 ( 0.79 ) |