I've got a data frame. say,
data.frame(x = c(1, 3), y = c(5, 0), id = c("A", "B"))
And now I want to duplicate it so I have a duplicate in the same data.frame. I'd end up with something like this,
data.frame(x = c(1, 3, 1, 3), y = c(5, 0, 5, 0), id = c("A", "B", "A", "B"))
Now, this is pretty close to what I want but I also want to append the id column to make them unique to each row based on the number of duplicates I want (in this case just one but I would want n many).
data.frame(x = c(1, 3, 1, 3), y = c(5, 0, 5, 0), id = c("A-1", "B-1", "A-2", "B-2"))
So, as you could see, I could wrap my head around making the objects, but I would like to move from doing "hacky" code with base R to replicating this functionality with dplyr.