TidierOrg / TidierData.jl

Tidier data transformations in Julia, modeled after the dplyr/tidyr R packages.
MIT License
86 stars 7 forks source link

`@filter ` will not interpolate column name #123

Open co1emi11er2 opened 6 days ago

co1emi11er2 commented 6 days ago

The following does not work:

t = :bar
s = "foo"
@chain df begin
    @filter(!!t == !!s)
end

This works though:

s = "foo"
@chain df begin
    @filter(bar == !!s)
end
drizk1 commented 6 days ago

Although the documentation is not yet updated, TidierData is shifting to use the following method of interpolation that leverages @eval and $ as a more robust way that avoids challenging edge cases

Demarcate the variables with $ and start the chain with @eval

t = :bar
s = "foo"
@eval @chain df begin
    @filter($t == $s)
end

This should work already without needing to update the package.