I am trying to convert a dataframe from wide to long
Currently, the dataframe is set up as:
ID | Value1 | Value2 | Value3 |
---|---|---|---|
1 | xxx | yyy | zzz |
2 | xxx | yyy | NA |
3 | xxx | yyy | NA |
4 | xxx | NA | NA |
5 | xxx | yyy | zzz |
I'd like it to look like this:
ID | Values |
---|---|
1 | xxx |
1 | yyy |
1 | zzz |
2 | xxx |
2 | yyy |
3 | xxx |
3 | yyy |
4 | xxx |
5 | xxx |
5 | yyy |
5 | zzz |
Any advice on how to do this?
I have tried to find code to convert from wide to long or transpose all columns into one, but am having trouble figuring this out. Thanks!