powered by
In-place operations like i += 1, i -= 1 is not support in R. These functions implement these operations in R.
i += 1
i -= 1
inc(e1, e2 = 1)mult(e1, e2 = 2)divi(e1, e2 = 2)
mult(e1, e2 = 2)
divi(e1, e2 = 2)
object, most likely a numeric object
the operation value, the value to add, subtract, multiply, divide of.
No return, directly assign the value back to e1
e1
inc(i) is the same as i <- i + 1. inc(i, -1) is the same as i <- i - 1. mult(i) is the same as i <- i * 2. divi(i) is the same as i <- i / 2.
inc(i)
i <- i + 1
inc(i, -1)
i <- i - 1
mult(i)
i <- i * 2
divi(i)
i <- i / 2
If you want shiny::reactiveVal version of these operators, check spsComps. shiny::reactiveValues operation will be the same as normal values.
# NOT RUN { i <- 0 inc(i) # add 1 i inc(i) # add 1 i inc(i, -1) # minus 1 i inc(i, -1) # minus 1 i x <- 1 mult(x) # times 2 x mult(x) # times 2 x divi(x) # divide 2 x divi(x) # divide 2 x # }
Run the code above in your browser using DataLab