I want to fill NAs in dataset by using identification variable:id. My dataset is like this:
id gender age other variables....
A NA NA
A NA NA
A f 23
B NA NA
B NA 45
C NA NA
The number of rows are not equal; and there are some id that has no gender information, or age information, or both information.
I want to fill NA's when it has a gender/age information, so that
id gender age other variables...
A f 23
A f 23
A f 23
B NA 45
B NA 45
C NA NA
I've been search for a few hours, but couldn't found how. I'll be really appreciated if anyone tell me how to do this.