if (FALSE) {
ds <- loadDataset("mtcars")
ds$cat_var <- cut(ds$mpg,
breaks = c(10, 15, 20),
labels = c("small", "medium"), name = "Fuel efficiency"
)
ds$age <- sample(1:100, 32)
ds$age4 <- cut(df$age, c(0, 30, 45, 65, 200),
c("Youth", "Adult", "Middle-aged", "Elderly"),
name = "Age (4 category)"
)
}
Run the code above in your browser using DataLab