Update label map by marking reversed outcomes
Source:R/margot_reversed_labels.R
margot_reversed_labels.Rd
Helper to tag reversed outcomes by appending "(reversed)" to labels.
Examples
label_mapping_all <- list(
t2_log_hours_exercise_z = "Hours of Exercise (log)",
t2_hlth_fatigue_z = "Fatigue",
t2_kessler_latent_anxiety_z = "Anxiety",
t2_kessler_latent_depression_z = "Depression",
t2_rumination_z = "Rumination",
t2_foregiveness_z = "Forgiveness",
t2_perfectionism_z = "Perfectionism",
t2_self_esteem_z = "Self Esteem",
t2_gratitude_z = "Gratitude",
t2_lifesat_z = "Life Satisfaction",
t2_meaning_purpose_z = "Meaning: Purpose",
t2_meaning_sense_z = "Meaning: Sense",
t2_pwi_z = "Personal Well-being Index",
t2_belong_z = "Social Belonging",
t2_neighbourhood_community_z = "Neighbourhood Community",
t2_support_z = "Social Support"
)
flip_outcomes <- c(
"t2_kessler_latent_anxiety_z",
"t2_kessler_latent_depression_z",
"t2_rumination_z"
)
# update mapping
label_mapping_all <- mark_reversed_labels(label_mapping_all, flip_outcomes)
#> Error in mark_reversed_labels(label_mapping_all, flip_outcomes): could not find function "mark_reversed_labels"
print(label_mapping_all)
#> $t2_log_hours_exercise_z
#> [1] "Hours of Exercise (log)"
#>
#> $t2_hlth_fatigue_z
#> [1] "Fatigue"
#>
#> $t2_kessler_latent_anxiety_z
#> [1] "Anxiety"
#>
#> $t2_kessler_latent_depression_z
#> [1] "Depression"
#>
#> $t2_rumination_z
#> [1] "Rumination"
#>
#> $t2_foregiveness_z
#> [1] "Forgiveness"
#>
#> $t2_perfectionism_z
#> [1] "Perfectionism"
#>
#> $t2_self_esteem_z
#> [1] "Self Esteem"
#>
#> $t2_gratitude_z
#> [1] "Gratitude"
#>
#> $t2_lifesat_z
#> [1] "Life Satisfaction"
#>
#> $t2_meaning_purpose_z
#> [1] "Meaning: Purpose"
#>
#> $t2_meaning_sense_z
#> [1] "Meaning: Sense"
#>
#> $t2_pwi_z
#> [1] "Personal Well-being Index"
#>
#> $t2_belong_z
#> [1] "Social Belonging"
#>
#> $t2_neighbourhood_community_z
#> [1] "Neighbourhood Community"
#>
#> $t2_support_z
#> [1] "Social Support"
#>
#> $t2_log_hours_exercise_z
#> [1] "Hours of Exercise (log)"
#> ...
#> $t2_kessler_latent_anxiety_z
#> [1] "Anxiety (reversed)"
#> ...