I have a data frame which includes: one column having individual ID's (unique), and a second column showing a common unique variable. That is, everyone in column 1 took the same action, which is shown in column B.
I'd like to write code in R which creates new rows, which pair everyone in column A based on column B.
that is, given this example:
person <- c("a", "b", "c", "d", "e", "f")
action <- c("x", "x", "x", "y", "y", "y")
data.frame(person, action)
I'd want to create this:
person1 <- c("a", "a", "b", "d", "d", "e")
person2 <- c("b", "c", "c", "e", "f", "f")
data.frame(person1, person2)