You can use the @astable macro-flag for this.
julia> df = DataFrame(
a = repeat(1:4, outer = 2),
b = ["a", "b", "c", "d", "e", "f", "g", "h"],
c = [23,76,9,90,123,67,13,5]);
julia> @by df :a @astable begin
maxval, ind = findmax(:c)
:c = maxval
:b = :b[ind]
end
4×3 DataFrame
Row │ a c b
│ Int64 Int64 String
─────┼──────────────────────
1 │ 1 123 e
2 │ 2 76 b
3 │ 3 13 g
4 │ 4 90 d