I have some geographical data that kinda looks like this:
name | x1 | x2 | x3 | x4 | y1 | y2 | y3 | y4 |
---|---|---|---|---|---|---|---|---|
Mark | 5 | 2 | 1 | 2 | 0 | 3 | 2 | 5 |
Amy | 0 | 5 | 1 | 5 | 0 | 3 | 2 | 5 |
And I would like to transform it into something like this to graph it easier on ggplot:
name | x | y |
---|---|---|
Mark | 5 | 0 |
Mark | 2 | 3 |
Mark | 1 | 2 |
Mark | 2 | 5 |
Amy | 0 | 0 |
Amy | 5 | 3 |
Amy | 1 | 2 |
Amy | 5 | 5 |
I have tried the function gather()
without any success.
Any help is appreciated.