calc_english_level {AOUSDOHtools} | R Documentation |
Calculate English Proficiency Level
Description
This function creates an ordinal categorical variable that describes the level of proficiency in English for participants who reported speaking a language other than English at home.
Usage
calc_english_level(survey_df)
Arguments
survey_df |
A data frame containing survey data with at least three columns: 'person_id', 'question_concept_id', and 'answer'. |
Value
A data frame with two columns: 'person_id' and 'english_level', where 'english_level' represents the participant's self-reported proficiency in English. Participants who did not respond or provided a "PMI: Skip" will have an NA value.
Examples
# Create a sample survey data frame
survey_df <- data.frame(
person_id = c(1, 2, 3, 4, 5),
question_concept_id = c(40192529, 40192529, 40192529, 40192529, 40192529),
answer = c("Very well", "Well", "Not well", "Not at all", "Skip")
)
# Compute English proficiency levels
english_level_scores <- calc_english_level(survey_df)
head(english_level_scores)
[Package AOUSDOHtools version 1.0.4 Index]