I would like to mutate age_group
from the variable age
. The desired age_group
will have four categories: 0–14, 15–44, 45–64, and > 64. What is the most efficient way of generating the variable -- using dplyr and base R?
# Data
toy_df <- data.frame(
age = c(1 , 2, 3, 17, 45, 54, 57, 68)
)