Description Usage Arguments Value Author(s) Examples
indicator function of an interval in the real line
1 |
x |
numeric vector of values to be tested. |
min |
numeric, scalar lower bound. - |
max |
numeric, scalar upper bound. |
liq |
character. Left inequality. ">" or ">=". |
riq |
characher. Right inequality. "<" or "<=". |
a logical vector with TRUE when x[i]
is in the interval given by the parameters of this function. Logical values were used for memory efficiency when large scale usage of this function.
Francisco Mendoza-Torres (mentofran@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 | xe <- c(-Inf, -3, 2, 6, Inf)
1 * indicator(x = xe, min = 2, max = 6, liq = ">=", riq = "<=")
indicator(x = xe, min = 2, max = 6, liq = ">=", riq = "<=")
indicator(x = xe, min = 2, max = 6, liq = ">" , riq = "<=")
indicator(x = xe, min = 2, max = Inf, liq = ">=", riq = "<")
indicator(x = xe, min = 2, max = Inf, liq = ">=", riq = "<=")
# Also works in the case that x is unique and min and max are vectors
xl <- c(-1, 0.3, -4)
xu <- c( 1, 1, -2)
indicator(0, xl, xu)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.