Sorry but I really don't understand what are you trying to accomplish with the code you are posting, as long as I know, an indicator function simply returns 1 or 0 depending on a defined treshold, like in this example.
library(dplyr)
df <- data.frame(
demand = c(0.24455661001999, 0.288511028213395, 0.000457341625207,
0.286052311527696, 0.22661840138977),
giniA = c(0.600622095598854, 0.611145511322019, 0.611145511322019,
0.609040828177386, 0.611145511322019)
)
df %>%
mutate(demand_indicator = if_else(demand > 0, 1, 0),
giniA_indicator = if_else(giniA > 0, 1, 0))
#> demand giniA demand_indicator giniA_indicator
#> 1 0.2445566100 0.6006221 1 1
#> 2 0.2885110282 0.6111455 1 1
#> 3 0.0004573416 0.6111455 1 1
#> 4 0.2860523115 0.6090408 1 1
#> 5 0.2266184014 0.6111455 1 1
Created on 2019-08-09 by the reprex package (v0.3.0.9000)