In one column of my dataframe I have some empty cells. The data looks like this:
yymmdd lat lon mag depth knmilocatie baglocatie tijd 19861226 52.
You need to index also the replacing column:
df[ df$baglocatie == "", "baglocatie" ] <- df[ df$baglocatie == "", "knmilocatie" ]