Coming from SQL, the transmute function feels a bit redundant when select exists. I keep wanting to be able to say:
myTibble <- tibble(a = c(1, 2, 3), b = c(5, 6, 7))
myTibble %>%
select(
a,
c = a + 1,
d = b
)
#Error in overscope_eval_next(overscope, expr) : object 'a' not found
The d = b works fine, so I am able to rename columns but not the c = a + 1.
Is it for a conceptual reason or a technical one?
With transmute it works fine:
myTibble <- tibble(a = c(1, 2, 3), b = c(5, 6, 7))
myTibble %>%
transmute(
a,
c = a + 1,
d = b
)