How to apply the pivot_longer and pivot_wider functions of the tidyr add-on package in the R programming language. More details: https://statisticsglobe.com/pivot_lon... R code of this video: data <- data.frame(ID1 = LETTERS[1:4], # Create example data ID2 = rep(letters[1:3], each = 4), x = 1:12, y = 21:32) install.packages("tidyr") # Install tidyr package library("tidyr") # Load tidyr package data_long <- pivot_longer(data = data, # Convert wide to long cols = c("x", "y")) data_wide <- pivot_wider(data = data_long) # Convert long to wide Follow me on Social Media: Facebook – Statistics Globe Page: / statisticsglobecom Facebook – Group for Discussions & Questions: / statisticsglobe LinkedIn – Statistics Globe Page: / statisticsglobe LinkedIn – Group for Discussions & Questions: / 12555223 Twitter: / joachimschork Music by bensound.com