{
library(dplyr)
###### Example 1: use madshapR_examples provided by the package
dataset <-
madshapR_examples$`dataset_example` %>%
mutate(prg_ever_cat = as_category(prg_ever)) %>%
mutate(prg_ever_no_cat = drop_category(prg_ever))
head(dataset[c("prg_ever_cat","prg_ever_no_cat")])
###### Example 2: any data frame can be a dataset
iris_no_cat <-
tibble(iris) %>% mutate(Species = drop_category(Species))
head(iris_no_cat)
}
Run the code above in your browser using DataLab