This scares me a bit because it means that fast filtering would have to happen with variables themselves, named in the code, instead of with functions, due to the non-standard evaluation. It’s an R-ism that I want to avoid if possible.
Specifically, nice for getting row number or index to create a @view of a dataframe. Views cant be made from the dataframe output of a filter or subset operation. This had me stumped for a while.
For example, I need to change the cells in column :X2 if the rows in column label match a string:
df_vw = @view df[∈(["label_p", "label_t", "label_w"]).(df.label), [:X1, :X2]]
# X1 is fraction, make into bips and update cell in :X2
transform!(df_vw, :X1 => ByRow(x -> string(round(Int, x * 100000), " bps")) => :X2)
# alternately with direct assignment:
df_vw[:, :X2 = string.(round.(Int, df_vw[:, :X1] * 10000), " bps")