labelmachine
is an R package that helps assigning meaningful
labels to data sets.
Furthermore, you can manage your labels
in so called lama-dictionary files, which are yaml files.
This makes it very easy using the same label translations in multiple
projects which share similar data structure.
Labeling your data can be easy!
# Install release version from CRAN install.packages("labelmachine") # Install development version from GitHub devtools::install_github('a-maldet/labelmachine', build_vignettes = TRUE)
The label assignments are given in so called translations (named character vectors), which are like a recipes, telling which original value will be mapped onto which new label. The translations are collected in so called lama_dictionary objects. This lama_dictionary objects will be used to translate your data frame variables.
Let df
be a data frame with marks and subjects, which should be translated
df <- data.frame( pupil_id = c(1, 1, 2, 2, 3), subject = c("en", "ma", "ma", "en", "en"), result = c(2, 1, 3, 2, NA), stringsAsFactors = FALSE ) df
Create a lama_dictionary object holding the translations:
library(labelmachine) dict <- new_lama_dictionary( subjects = c(en = "English", ma = "Mathematics", NA_ = "other subjects"), results = c("1" = "Excellent", "2" = "Satisfying", "3" = "Failed", NA_ = "Missed") ) dict
Translate the data frame variables:
df_new <- lama_translate( df, dict, subject_new = subjects(subject), result_new = results(result) ) str(df_new)
labelmachine
offers the following features:
A short introduction can be found here: Get started
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.