{
library(dplyr)
# use madshapR_examples provided by the package
dataset <- madshapR_examples$`dataset_example`
data_dict <- as_data_dict_mlstr(madshapR_examples$`data_dictionary_example`)
dataset <- data_dict_apply(dataset,data_dict)
# the data dictionary contains no categorical variable.
# create a category in the dataset
dataset <- dataset %>% mutate(gndr = as_category(gndr, labels = c("coucou" = 1),na_values = 2))
new_data_dict <- data_dict_update(data_dict, dataset, "gndr")
head(dataset)
}
Run the code above in your browser using DataLab