BoAcharai › Lessons › RStudio

Step-by-step lesson · RStudio

How to reshape data with tidyr in RStudio

4 steps

  1. Type library(tidyr)
  2. Type long <- pivot_longer(data, cols = c(t1, t2), names_to = "time", values_to = "score")
  3. Type head(long) to check
  4. Use pivot_wider to go back

More in RStudio

All RStudio lessons