# How to access the output from Chain.jl?

**URL:** https://discourse.julialang.org/t/how-to-access-the-output-from-chain-jl/63699
**Category:** New to Julia
**Created:** [June 28, 2021, 1:48pm UTC](https://discourse.julialang.org/t/how-to-access-the-output-from-chain-jl/63699 "2021-06-28T13:48:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CompulsoryCoffee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compulsorycoffee/32/30434_2.png) [@CompulsoryCoffee](https://discourse.julialang.org/u/CompulsoryCoffee)
#### Post date: [June 28, 2021, 1:48pm UTC](https://discourse.julialang.org/t/how-to-access-the-output-from-chain-jl/63699/1 "2021-06-28T13:48:01Z")

</div>

Hi,

Discovering Julia and loving it.  
I started to dabble with the piping method with Dataframes but can’t get the output as a variable.

for example, how do I get the updated df returned in this case?

```julia
@chain df begin 
    by(_, [:a1], nrow)
    rename!(_, :x1 => :count)
end

```

Thanks!

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [June 28, 2021, 4:10pm UTC](https://discourse.julialang.org/t/how-to-access-the-output-from-chain-jl/63699/2 "2021-06-28T16:10:04Z")

</div>

Just do

```julia
new_df = @chain df begin 
    by(_, [:a1], nrow)
    rename!(_, :x1 => :count)
end

```

---

<div class="post-metadata">

### Author: ![CompulsoryCoffee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compulsorycoffee/32/30434_2.png) [@CompulsoryCoffee](https://discourse.julialang.org/u/CompulsoryCoffee)
#### Post date: [June 29, 2021, 8:56am UTC](https://discourse.julialang.org/t/how-to-access-the-output-from-chain-jl/63699/3 "2021-06-29T08:56:14Z")

</div>

Thanks!
