Algebra to R syntax instead of Python