Counters {invctr} | R Documentation |
Counters
Description
Counters
Signed increment
Non-negative increment
Usage
counter %+-% increment
counter %++% increment
Arguments
counter |
If |
increment |
An integer value |
Examples
## Not run:
# Signed increment
# Notice the difference between passing an object and a value for counter
# Value
(10 %+-% -5)
(10 %+-% -5)
# Object
i <- 10
(i %+-% -5)
(i %+-% -5)
# This means we can use the infix in a while ... statement
# WARNING: As is the case for any while ... statement, be careful not to create an infinite loop!
i <- 10
while(i > -5){
i %+-% -5
print(i)
}
# Non-negative increment
# Notice the difference between passing an object and a value for counter
# Value
(0 %++% 5)
(0 %++% 5)
# Object
i <- 0
(i %++% 5)
(i %++% 5)
# This means we can use the infix in a while ... statement
# WARNING: As is the case for any while ... statement, be careful not to create an infinite loop!
i <- 0
while(i < 20){
i %++% 5
print(i)
}
## End(Not run)
[Package invctr version 0.2.0 Index]