I have a large data frame and part of it look like this:
   id carbon nitrogen sulfer
1   1     NA       NA     NA
2   1     NA       NA     NA
3   1      5        6     78
4   2     NA       NA     NA
5   2     NA       NA     NA
6   2      8        8     67
7   3     NA       NA     NA
8   3     NA       NA     NA
9   3     NA       NA     NA
10  3      7        9     55
Is there a way I can filled the NA values in columns (example carbon), with one value given common to id. For example if we take id == 1 then for column carbon has value of 5 and need to replace NA with 5. 
I have nearly 200 columns to filled like this.
Any help to automate this is much appreciated.
 
     
     
    