I have a distribution of travel time. I am looking to do a log with base 2 transformations to get better graphs. Since, log is undefined at 0, the function leaves out all these values.

Is there any way to preserve all values that have 0 travel time and just use log approximation on other values such that

if x >0 then log (x);

else 0

MWE:

t = tibble(x = c(0, 0, 0, 1, 1, 1, 10, 10, 10, 100, 100, 100, 1000, 1000, 1000))

p = t %>%

ggplot(aes(x = x)) +

geom_histogram() +

scale_x_continuous(

trans=scales::pseudo_log_trans(base = 10),

breaks = scales::trans_breaks("log10", identity))