This question is a \"why\", not a how. In the following code I\'m trying to understand why dplyr::mutate evaluates one custom function (f()) with t
dplyr::mutate
f()
We can loop through each element of 'a' using map and apply the function f
map
f
library(tidyverse) df %>% mutate(asq = a^2, fout = map_dbl(a, f), gout = g(a)) # a asq fout gout #1 0 0 10.88874 0.0000000 #2 10 100 1010.88874 -0.5440211 #3 100 10000 10010.88874 -0.5063656