Switching from Python to R