Open
Description
I like to use magrittr aliases for arithmetic operations to get the Order of operations correct without playing around with parathesis when working with complicated formulas. Though today I noticed the results are sensitive to how results are feed into the function and it behaves unexpectedly wrong.
library(magrittr)
test <- 1
test_nopipe <- test^2/2 + test^2/2
test_expressions <- test^2/2 %>%
add(test^2/2)
step <- test^2/2
test_asvariable <- step %>%
add(step)
test^2
#> [1] 1
test_expressions #Wrong
#> [1] 0.4
test_nopipe
#> [1] 1
test_asvariable
#> [1] 1
Metadata
Metadata
Assignees
Labels
No labels