# Looping Over Two Variables (indexes) in a DataFrame

**URL:** https://discourse.julialang.org/t/looping-over-two-variables-indexes-in-a-dataframe/83531
**Category:** New to Julia
**Tags:** question
**Created:** [June 29, 2022, 8:10pm UTC](https://discourse.julialang.org/t/looping-over-two-variables-indexes-in-a-dataframe/83531 "2022-06-29T20:10:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tgalois](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@tgalois](https://discourse.julialang.org/u/tgalois)
#### Post date: [June 29, 2022, 8:10pm UTC](https://discourse.julialang.org/t/looping-over-two-variables-indexes-in-a-dataframe/83531/1 "2022-06-29T20:10:23Z")

</div>

Hello Everyone,

I am running a simulation study looping (for loop) over two indexes. In R we can do this::  
for i in 1:100{  
for j in c(15, 30, 50, 400){  
df1$result[df1$snum==i & df1$szise==j]\<-dosomething[df2$snum=i & df2$szise==j]  
}  
}  
I am trying to get this to work in Julia; any suggestions?

---

<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 29, 2022, 8:59pm UTC](https://discourse.julialang.org/t/looping-over-two-variables-indexes-in-a-dataframe/83531/2 "2022-06-29T20:59:53Z")

</div>

What have you tried so far? This should be pretty easy to translate into Julia. Start by replacing the `$` with `.` and the `{...}` with `begin...end`
