I am new to R coming from Python. So I still tend to revert back to old habits. Specially using for loops. So I want to create a custom function that takes two variables ( d