coa introduces compound assignment operators
You can install the development version of coa using:
devtools::install_github("[email protected]:Noza23/coa.git")
This is a basic example which shows you how to solve a common problem:
library(coa)
x <- 10
print(x %+=% 1)
#> [1] 11
print(x %-=% 5)
#> [1] 6
print(x %*=% 2)
#> [1] 12
print(x %/=% 5)
#> [1] 2.4
print(x %c=% 1:5)
#> [1] 2.4 1.0 2.0 3.0 4.0 5.0
print(`++`(x))
#> [1] 3.4 2.0 3.0 4.0 5.0 6.0
print(`--`(x))
#> [1] 2.4 1.0 2.0 3.0 4.0 5.0