combination_function | R Documentation |
CombinationFunction
CombinationFunction
is an S4 class which extends standard functions. These are special functions that
can be combined and negated with the logical operators.
## S4 method for signature 'CombinationFunction,CombinationFunction'
e1 & e2
## S4 method for signature 'CombinationFunction,CombinationFunction'
e1 | e2
## S4 method for signature 'CombinationFunction'
!x
e1 |
( |
e2 |
( |
x |
( |
A logical value indicating whether the left hand side of the equation equals the right hand side.
e1 & e2
: Logical "AND" combination of CombinationFunction
functions.
The resulting object is of the same class, and evaluates the two argument functions. The result
is then the "AND" of the two individual results.
e1 | e2
: Logical "OR" combination of CombinationFunction
functions.
The resulting object is of the same class, and evaluates the two argument functions. The result
is then the "OR" of the two individual results.
`!`(CombinationFunction)
: Logical negation of CombinationFunction
functions.
The resulting object is of the same class, and evaluates the original function. The result
is then the opposite of this results.
higher <- function(a) {
force(a)
CombinationFunction(
function(x) {
x > a
}
)
}
lower <- function(b) {
force(b)
CombinationFunction(
function(x) {
x < b
}
)
}
c1 <- higher(5)
c2 <- lower(10)
c3 <- higher(5) & lower(10)
c3(7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.