Go from long to wide using tidyr's pivot_wider
问题 I have a simple long df where every element in the fi column should be a new column in the wide df. So the new df should have 10 columns A:J. The wide df should have two rows, "one" and "two". Sounds like a job for pivot_wider, but I couldn't get it to work. library("tidyverse") df <- structure(list(fi = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J"), one = c(0.5, 1.4, 0.89, 1.4, 1.45, 1.25, 1.45, 1.4, 1.4, 1.5), two = c(0.75, 1.6, 1.05, 1.6, 1.45, 1.05, 1.65, 1.5, 1.55, 1.65)), row