Using Nested If Function Python Syntax If Else Statement In R