I am translating some code from Python to R, and am finding it hard to find the corresponding functions in each. In this particular case, the code I\'m having trouble with i