I have data.frame containing travel Duration time from several cities to some destinations. The structure (simplified) looks like the table below:
city | dest1 | dest2 | closest
------+-------+-------+--------
cityA | NA | NA | cityC
cityB | NA | NA | cityD
cityC | 100 | 200 | cityA
cityD | 300 | 400 | cityB
Now I want to approximate the travel duration from cityA to dest1 by the travel duration from cityC to dest1 (because cityC is closest to cityA, last column), i.e. I want to replace the NA value in the upper left with 100.
Is there a possibility to do this smoothly with dplyr functions?