Create Interval Label from Upper and Lower Boundary
Source:R/breaksToIntervalLabels.R
intervalLabel.Rd
Create a label for the interval defined by the upper boundary a
and
the lower boundary b
Arguments
- a
upper boundary
- b
lower boundary
- right
if TRUE (default) the interval is closed at the upper boundary
- style
integer number between 1 and 5 indicating one of five possible styles to name the interval between
a
andb
. See examples below.- sep
separator to be used between lower and upper boundary
- space
space between comparison operators and boundary values.
Examples
# Labels of different styles for right closed intervals (right = TRUE is the
# default)
intervalLabel(1, 10, style = 1) # "(1,10]"
#> [1] "(1,10]"
intervalLabel(1, 10, style = 2) # "<= 10"
#> [1] "<= 10"
intervalLabel(1, 10, style = 3) # "> 1"
#> [1] "> 1"
intervalLabel(1, 10, style = 4) # "<= " "> 1" (vector of two elements!)
#> [1] "<= " "> 1"
intervalLabel(1, 10, style = 5) # "<= 10" "> " (vector of two elements!)
#> [1] "<= 10" "> "
# The same with left closed intervals:
right <- FALSE
intervalLabel(1, 10, right, style = 1) # "[1,10)"
#> [1] "[1,10)"
intervalLabel(1, 10, right, style = 2) # "< 10"
#> [1] "< 10"
intervalLabel(1, 10, right, style = 3) # ">= 1"
#> [1] ">= 1"
intervalLabel(1, 10, right, style = 4) # "< " ">= 1" (vector of two elements!)
#> [1] "< " ">= 1"
intervalLabel(1, 10, right, style = 5) # "< 10" ">= " (vector of two elements!)
#> [1] "< 10" ">= "