# Create a sample survey data frame
survey_df <- data.frame(
person_id = rep(1:3, each = 8),
question_concept_id = rep(c(40192388, 40192399, 40192439, 40192442,
40192446, 40192480, 40192511, 40192528), times = 3),
answer_concept_id = sample(c(40192454, 40192518, 40192486, 40192382, 40192521),
24, replace = TRUE)
)
# Compute social support scores
social_support_scores <- calc_social_support(survey_df)
head(social_support_scores)
Run the code above in your browser using DataLab