Suppose I have a data frame with a list of names:
> x <- c("a", "b", "c")
> x <- as.data.frame(x)
# > x
# 1 a
# 2 b
# 3 c
I want to spread each unique name (x, below) to each name (y, below) and create a new column before the original column so that the new data frame looks like this:
# > z
# x y
# a a
# a b
# a c
# b a
# b b
# b c
# c a
# c b
# c c
This is for creating a "from" "to" edge list in igraph where the network is full.
How could I do this? Is there a simple tidyverse solution that I'm missing?