Hi. I find when I incorrectly calculate expressions like this, it is because I am careless with parentheses. One solution is to use plenty of parentheses to ensure order of operations is being done correctly. Another solution is not to do everything in a single line of R code; use two or more lines, and then combine the separate expressions at the end.