I need to make a scatter plot for days vs age for the f group (sex=1) and make another scatter plot for days vs age for the m group (sex=2) using R
days vs age
spread splits data by column values. This is also called converting data from "long" to "wide".
I haven't tested this, but something like
spread(data, sex, age)
should get you
days 1 2 306 74 NA 455 NA 67 1000 55 NA 505 65 NA 399 NA 54 495 NA 66