# NOT RUN {
library(data.table)
example_dt <- data.table(z = rep(c("a", "b", "c"), 2),
stuff = c(rep("x", 3), rep("y", 3)),
things = 1:6)
dt_pivot_wider(example_dt, names_from = stuff, values_from = things)
dt_pivot_wider(example_dt, names_from = stuff, values_from = things, id_cols = z)
# }
Run the code above in your browser using DataLab