My data is the following:
tibble(var1.q = 0.01, var2.q = .99, var3.q = .45) -> foo
I would like to calculate 2 * min{x, 1-x} for each column.
In base R, I could do
2*apply(bind_rows(foo, 1-foo), 2, FUN=min)
but I struggle to find the tidyverse equivalent of this.
Expected result:
0.02 0.02 0.90