Basically, there has been a data entry mistake in my data. It's the record of patients where data is collected and recorded twice from the same patient (assume no time series complexity). However, in this process, the Gender, Age and Patient's ID is not replicated for the second entry of his/her medical record. As a result, half the dataset has "NA" in the above mentioned variables. I just need a code which pastes the prior entry in these variables in place of the NA values. Thanks a lot.
Asked
Active
Viewed 63 times
0
-
1Please give a [mcve]! ... and have a look at `na.locf()` from `library("zoo")` – jogo Aug 18 '17 at 11:45
-
Thanks a lot @jogo . na.locf is the day saver! – Hamza Kamran Aug 18 '17 at 12:01
-
2Thanks a lot @zx8754. Those answers are really helpful – Hamza Kamran Aug 18 '17 at 12:01