Created
March 24, 2022 17:53
-
-
Save jmcastagnetto/16e5b2383e5e998a754cd966c1f9cb77 to your computer and use it in GitHub Desktop.
pivot_wider() on a char column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
d <- tibble( | |
id = c(1, 1, 2, 2), | |
foo = c("oh", "no", "oh", "no"), | |
bar = c("hmmm", "ok", "right", "sure?") | |
) | |
d %>% | |
pivot_wider( | |
names_from = foo, | |
values_from = bar | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output