I don’t understand what the actual transformation you are trying to do is, but here is an answer using DataFramesMeta.jl
julia> t = @rtransform df :x1 = begin
better_than = :score .> (:sum .+ 1)
:score[better_than]
end;
julia> @select t :id :x1
3×2 DataFrame
Row │ id x1
│ String Array…
─────┼─────────────────────────────
1 │ 1 [2, 22, 25, 5]
2 │ 2 [2]
3 │ 3 [24, 54, 89, 12, 2]
EDIT: you want
julia> t = @rtransform df :x1 = begin
better_than = :sum .>= 1
:score[better_than]
end;