-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hello,
I cam across this package when searching for a way to easily translate factors in R. The possibility to use a YAML file sold it. However, your package currently requires an exhaustive list of translations to function. Would you consider easing this restriction?
I have a data set of around 200+ factors of which I only need to translate 30-40.
E.g., It would be nice if the following could work:
library(labelmachine)
df <- data.frame(
pupil_id = rep(1:4, each = 3),
subject = rep(c("eng", "mat", "Gymnastics"), 4),
result = c(1, 2, 2, NA, 2, NA, 1, 0, 1, 2, 3, NA),
stringsAsFactors = FALSE
)
dict <- new_lama_dictionary(
sub = c(eng = "English", mat = "Mathematics"),
res = c(
"1" = "Good",
"2" = "Passed",
"3" = "Not passed",
"4" = "Not passed",
NA_ = "Missed",
"0" = NA
)
)
df_new <- lama_translate(
df,
dict,
subject_lab = sub(subject),
result_lab = res(result)
)
Which currently errors with:
Error: Error while calling 'lama_translate': Translation 'sub' could not be applied to column 'subject': The following values in the column variable could not be found in the translation: 'Gymnastics'.
/Kind regards/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request