# Create a sample survey data frame
survey_df <- data.frame(
person_id = c(1, 2, 3, 4, 5),
question_concept_id = c(40192458, 40192458, 40192458, 40192458, 40192458),
answer_concept_id = c(40192407, 40192472, 40192418, 40192433, 40192409)
)
# Compute residential density categories
density_scores <- calc_density(survey_df)
head(density_scores)
Run the code above in your browser using DataLab