Bugzilla – Bug 15179
Expressions with %any% operators do not deparse correctly.
Last modified: 2013-01-20 15:38:06 UTC
Expressions constructed using multiple %any% operators do not deparse with parentheses to preserve the order of operations.
x <- 2
y <- pi
z <- exp(1)
`%^%` <- `^`
expr <- quote( `%^%`(x, `%^%`(y,z)))
print(expr) # should have parentheses
eval(parse(text=deparse(expr))) #should be the same
interestingly deparsing appears to be correct if the functions are `%*%` or `%/%`, but not for other functions.
Confirmed. I'll fix it. The reason %*% and %/% are handled properly is because they are built in operators. The deparse code handles them separately from user-defined operators. I'll fix the deparsing to be consistent.
Fixed in R-devel and R-patched