Skip to content

Commit

Permalink
Change index.md first example
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanrboyer authored Apr 18, 2024
1 parent bed917d commit 8f16825
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ See below the convenience of DataFramesMeta compared to DataFrames.
df = DataFrame(a = [1, 2], b = [3, 4]);

# With DataFrames
transform(df, [:a, :b] => ((a, b) -> a .* b .+ first(a) .- sum(b)) => :c);
transform(df, [:a, :b] => ((x, y) -> x + y) => :c)

# With DataFramesMeta
@transform(df, :c = :a .* :b .+ first(:a) .- sum(:b))
@transform(df, :c = :a + :b)

# With DataFrames
subset(df, :a => ByRow(==(2)))

# With DataFramesMeta
@rsubset(df, :a == 2)
```

To reference columns inside DataFramesMeta macros, use `Symbol`s. For example, use `:x`
Expand Down

0 comments on commit 8f16825

Please sign in to comment.