# Create a sample survey data frame
survey_df <- data.frame(
person_id = c(1, 1, 2, 2, 3, 3, 4, 4),
question_concept_id = c(40192463, 40192411, 40192463, 40192411,
40192499, 40192417, 40192499, 40192417),
answer_concept_id = c(40192514, 40192455, 40192524, 40192408,
40192514, 40192524, 40192408, 40192422)
)
# Compute neighborhood cohesion scores
cohesion_scores <- calc_cohesion(survey_df)
head(cohesion_scores)
Run the code above in your browser using DataLab