Using the tidyr Library you can transform a dataset with the gather(), spread(), separate() and unit() functions.
Function
Objectives
Arguments
gather()
Transform the data from wide to long
(data, key, value, na.rm = FALSE)
spread()
Transform the data from long to wide
(data, key, value)
separate()
Split one variables into two
(data, col, into, sep= "", remove = TRUE)
unit()
Unit two variables into one
(data, col, conc ,sep= "", remove = TRUE)