# Create a sample survey data frame
survey_df <- data.frame(
person_id = rep(1:3, each = 4),
question_concept_id = rep(c(40192399, 40192439, 40192446, 40192528), times = 3),
answer_concept_id = sample(c(40192454, 40192518, 40192486, 40192382, 40192521),
12, replace = TRUE)
)
# Compute emotional support scores
emo_support_scores <- calc_emo_support(survey_df)
head(emo_support_scores)
Run the code above in your browser using DataLab