# Example with LimeSurvey-style column names
df <- data.frame(
"age. Age of respondent" = c(25, 30),
"score. Total score. Manually computed." = c(12, 14),
check.names = FALSE
)
# sep = ". " by default (LimeSurvey)
out <- label_from_names(df)
labelled::var_label(out)
# Example with a custom separator ("|")
df2 <- data.frame(
"id|Identifier" = 1:3,
"score|Total score" = c(10, 20, 30),
check.names = FALSE
)
out2 <- label_from_names(df2, sep = "|")
labelled::var_label(out2)
Run the code above in your browser using DataLab