Skip to content

Commit

Permalink
update src/linq.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeffebach committed Jul 7, 2021
1 parent 9210b05 commit e8a21ef
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/linqmacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export @linq, linq
"""
@linq df ...
!!! note
`@linq` is deprecated. Use `@chain` instead. See `? @chain` for details.
General macro that creates a mini DSL for chaining and macro calls.
### Details
Expand All @@ -34,11 +38,11 @@ julia> df = DataFrame(
b = repeat(2:-1:1, outer = 4),
x = 1:8);
julia> x1 = @linq transform(where(df, :a .> 2, :b .!= "c"), y = 10 .* :x);
julia> x1 = @linq transform(where(df, :a .> 2, :b .!= "c"), :y = 10 .* :x);
julia> x1 = @linq by(x1, :b, meanX = mean(:x), meanY = mean(:y));
julia> x1 = @linq by(x1, :b, :meanX = mean(:x), :meanY = mean(:y));
julia> @linq select(orderby(x1, :b, -:meanX), var = :b, :meanX, :meanY)
julia> @linq select(orderby(x1, :b, -:meanX), :var = :b, :meanX, :meanY)
2×3 DataFrame
│ Row │ var │ meanX │ meanY │
│ │ Int64 │ Float64 │ Float64 │
Expand All @@ -49,7 +53,7 @@ julia> @linq select(orderby(x1, :b, -:meanX), var = :b, :meanX, :meanY)
julia> @linq df |>
transform(y = 10 .* :x) |>
where(:a .> 2) |>
by(:b, meanX = mean(:x), meanY = mean(:y)) |>
by(:b, :meanX = mean(:x), :meanY = mean(:y)) |>
orderby(:meanX) |>
select(:meanX, :meanY, var = :b)
2×3 DataFrame
Expand Down

0 comments on commit e8a21ef

Please sign in to comment.