It’s interesting to know why this does not work in Tidier.jl
:
using DataFrames, Chain, Tidier
culture = DataFrame(
ind = [1, 1, 1, 2, 2, 2],
year = [2015, 2015, 2015, 2016, 2016, 2016],
value = [10, 20, 30, 26, 34, 67]
)
culture_w = @chain culture begin
@group_by(year)
@mutate(total = sum(value), w = value / total)
end