julia> combine(df, vcat.(["x1", "x2"], "xfun") .=> ByRow((x,f) -> f(x)) => first)
3×2 DataFrame
Row │ x1 x2
│ Int64 Array…
─────┼───────────────────
1 │ 0 [0, 1]
2 │ 4 [9, 16]
3 │ 27 [125, 216]
and instead of ["x1", "x2"] provide an expression that generates the column names you want to include.