I also want to stress that with the @aside
macro, you can do this kind of loop inside the @chain
block. This is something you can’t do in dplyr
, and is probably the cause of some of it’s more complicated all-in-one-call syntaxes.
julia> using DataFramesMeta;
julia> df = DataFrame(rand(20, 10), :auto);
julia> @chain df begin
@rtransform :y = :x1 + :x2
@aside begin
nms = names(df, Between(:x5, :x9))
for n in nms
@rtransform! _ $n = $n + 100
end
_
end
@rtransform :z = :x8 + :x9
end