I have a data.frame in R and want to fill in some empty cells in specific way. Below is the table.
Case.ID   |   Resource
-----------------------
   1      |     501
-----------------------
   1      | 
-----------------------
   1      |      0
-----------------------
   1      |      
-----------------------
   2      |    524
-----------------------
Here, I want to replace empty cells into the very first value of each Case.ID, in this case replace empty cells with Case.ID = 1 into 501, not 0.
 
     
     
     
    