Last chance! 50% off unlimited learning
Sale ends in
interval
constructs an object of class interval
representing an interval.
liesWithin
checks if a number lies within a given interval.
interval(lower, upper, left=c(">=", ">"), right=c("<=", "<"))<="" p="">liesWithin(x, int)
the lower boundary of the interval. Can be set to -Inf
.
the upper boundary of the interval. Can be set to Inf
.
a comparison symbol. Must be one of (“>=”,
“>”) for left
and (“<=”,
“<”) for right
, respectively. Determines whether the
boundary values are included in the interval or not. The default is
“>=” and “<=”, respectively.
a numeric vector or array giving the numbers to be checked.
an interval object.
interval
returns an object of class interval
containing
the following components:
the lower boundary of the interval
the upper boundary of the interval
the left comparison operator
the right comparison operator
liesWithin returns TRUE if the given number lies within the interval and FALSE otherwise.
# NOT RUN {
i <- interval(-3, 3, left=">")
liesWithin(-3:5, i)
# }
Run the code above in your browser using DataLab