# Create a sample survey data frame
survey_df <- data.frame(
person_id = rep(1:3, each = 7),
question_concept_id = rep(c(40192436, 40192440, 40192437, 40192431,
40192410, 40192492, 40192414), times = 3),
answer_concept_id = sample(c(40192514, 40192478, 40192527, 40192422),
21, replace = TRUE)
)
# Compute environmental support for physical activity (SPA) scores
spa_scores <- calc_spa(survey_df)
head(spa_scores)
Run the code above in your browser using DataLab