View source: R/calc_ins_support.R
calc_ins_support | R Documentation |
This function computes a numeric instrumental support score ranging from 0 to 100. The score is the mean of individual item scores transformed to a 0-100 scale, where higher scores indicate greater tangible support.
calc_ins_support(survey_df)
survey_df |
A data frame containing survey data with at least three columns: 'person_id', 'question_concept_id', and 'answer_concept_id'. |
A data frame with two columns: 'person_id' and 'ins_support', where 'ins_support' is the calculated instrumental support score for each participant. The score is scaled from 0 to 100, with higher values indicating more tangible support. Participants who did not answer all four relevant questions will have NA values.
# Create a sample survey data frame
survey_df <- data.frame(
person_id = rep(1:3, each = 4),
question_concept_id = rep(c(40192388, 40192442, 40192480, 40192511), times = 3),
answer_concept_id = sample(c(40192454, 40192518, 40192486, 40192382, 40192521),
12, replace = TRUE)
)
# Compute instrumental support scores
ins_support_scores <- calc_ins_support(survey_df)
head(ins_support_scores)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.