# NOT RUN {
# create id
mtcars$id <- 1:nrow(mtcars)
gathered <- gather(mtcars, "col", "data", -id)
#> gather: reorganized (mpg, cyl, disp, hp, drat, <U+2026>) into (col, data) [was 32x12, now 352x3]
spread(gathered, col, data)
#> spread: reorganized (col, data) into (am, carb, cyl, disp, drat, <U+2026>) [was 352x3, now 32x12]
# }
Run the code above in your browser using DataLab