xs |> Map(f) |> collect and collect(Map(f), xs) are both equivalent to
ys = []
for x in xs
push!(ys, f(x))
end
ys
So, row_data |> Map(mean) |> collect is computing
v = [
mean((a[1], b[1], c[1], d[1])),
mean((a[2], b[2], c[2], d[2])),
...
mean((a[end], b[end], c[end], d[end])),
]
Then, since foldl(right, v) is equivalent to v[end], you obtain a number mean((a[end], b[end], c[end], d[end])), from foldl(right, row_data |> Map(mean) |> collect).
As others said, I think using “columnar” functions is the best way to do this. That said, if you really want to do this in row-wise fashion (e.g., input does not fit in the memory), you can use GitHub - JuliaFolds/DataTools.jl
julia> using Transducers
julia> using DataTools: oncol, averaging
julia> foldxl(oncol(a = averaging, b = averaging, c = averaging, d = averaging), Tables.rowtable(table))
(a = 2.999957367033291, b = 0.00019357701607686137, c = 0.0009838445182253483, d = -0.00026117276633180807)