Could you please help me translate the following code of R to julia as I am new in Julia?
I know Julia has different ways to replace for loop, if one of these ways ca