How to reshape data from long to wide format Using reshape function: reshape(dat1, idvar = "name", timevar = "numbers", direction = "wide")