Here is one way to do it. I used mutate_if in case your actual data frame has some columns that are not numeric. Are you sure that it is ok to effectively replace all of your zeros with ones in the pre-log data set?
DF <- data.frame(A = log(c(0, 2,0)), B = log(c(1,0,5)), C = log(c(4,4,0)))
DF
#> A B C
#> 1 -Inf 0.000000 1.386294
#> 2 0.6931472 -Inf 1.386294
#> 3 -Inf 1.609438 -Inf
library(dplyr)
DF <- DF %>% mutate_if(is.numeric, function(x) ifelse(is.infinite(x), 0, x))
DF
#> A B C
#> 1 0.0000000 0.000000 1.386294
#> 2 0.6931472 0.000000 1.386294
#> 3 0.0000000 1.609438 0.000000
Your first try was a good idea. This works correctly - just don't assign it to the whole data.frame too Log.df <-. That is why your whole set is replaced. Log.df <- Log.df[Log.df == -Inf] <- 0 assigns 0 to the Inf values but also to Log.df so erase the whole data.frame
Log.df <- data.frame(A = log(c(0, 2,0)), B = log(c(1,0,5)), C = log(c(4,4,0)))
Log.df[Log.df == -Inf] <- 0
Log.df
#> A B C
#> 1 0.0000000 0.000000 1.386294
#> 2 0.6931472 0.000000 1.386294
#> 3 0.0000000 1.609438 0.000000