I'm super new to R overall and I'm working with a long dataframe with the ultimate goal of creating a density plot. The dataframe is just two variables of heights; one fheight and the other sheight for father and son respectively. I need to rearrange this data so that the varibles are in another column "relationships" with father and son and the corresponding heights (160, 175, etc...).
library(dplyr)
father_height | son_height |
---|---|
165.2 | 151.8 |
160.7 | 160.6 |
165.0 | 160.9 |
The ultimate goal here is to create a density plot with both of these measured. Any help would be amazing.
ETA: My expected output would be similar to below:
relationships | heights |
---|---|
father | 165.2 |
son | 151.8 |
father | 160.7 |