A simple example of long to wide pivot:
library(tidyverse) library(data.table) df <- data.frame(names=letters[1:3],values=1:3) df %>% pivot_wider(names