# Use gather() to convert the dataset to long format air.long <- gather(airquality, variable, value, -Month, -Day) head(air.long) # Note that the syntax used here indicates we wish to gather ALL the columns except "Month" and "Day" # Then, use spread() to convert the dataset back to wide format air.wide <- spread(air.long , variable, value) head(air.wide)