JuliaData / JuliaData/DataFramesMeta.jl

Allow reference to previously defined columns in @transform

Open
#388 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
496
Forks
56
PR merge metrics
No merged PRs in 30d

Description

This might be too big of an ask, but in dplyr we can do this

data.frame(x=c(1,2,3)) %>% mutate(y=2*x, z=y+2)

that is, defining z and then using it in the same mutate call.

But is not possible with @transform. It would be very nice to be able to do

@transform DataFrame(x=[1,2,3]) begin
    :y = :x .* 2
    :z = :y .+ 2
end

Is there a reason this isn't supported?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the @transform macro and how expressions in a single transform block are evaluated. Confirm the desired behavior using the issue's x, y, and z example, then define completion as allowing z to reference the newly defined y while preserving existing transform behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.