Skip to content

Commit

Permalink
Merge pull request #709 from KingArthur0205/branch-2
Browse files Browse the repository at this point in the history
SBD_Smith_2020.r
  • Loading branch information
ben-domingue authored Nov 26, 2024
2 parents 8d96f7c + 4b173b6 commit 0243d33
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/SBD_Smith_2020.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Paper: https://www.sciencedirect.com/science/article/pii/S0165032719302046
# Data: https://osf.io/c4v7g/
library(haven)
library(dplyr)
library(tidyr)
library(openxlsx)

df <- read.table("bpses_pre_for_factor.dat", header = TRUE, sep = ",", stringsAsFactors = FALSE)
colnames(df) <- paste0("MBDS", 1:22)
df$id <- seq_len(nrow(df))
df <- pivot_longer(df, cols=-id, values_to = "resp", names_to = "item")
df$resp[df$resp == 999] <- NA

save(df, file="SBD_Smith_2020.Rdata")
write.csv(df, "SBD_Smith_2020.csv", row.names=FALSE)

0 comments on commit 0243d33

Please sign in to comment.