| cut_hour {vivainsights} | R Documentation |
Convert a numeric variable for hours into categorical
Description
Supply a numeric variable, e.g. Collaboration_hours, and return a character
vector.
Usage
cut_hour(metric, cuts, unit = "hours", lbound = 0, ubound = 100)
Arguments
metric |
A numeric variable representing hours. |
cuts |
A numeric vector of minimum length 3 to represent the cut points required. The minimum and maximum values provided in the vector are inclusive. |
unit |
String to specify the unit of the labels. Defaults to "hours". |
lbound |
Numeric. Specifies the lower bound (inclusive) value for the minimum label. Defaults to 0. |
ubound |
Numeric. Specifies the upper bound (inclusive) value for the maximum label. Defaults to 100. |
Details
This is used within create_dist() for numeric to categorical conversion.
Value
Character vector representing a converted categorical variable, appended
with the label of the unit. See examples for more information.
See Also
Other Support:
any_idate(),
camel_clean(),
check_inputs(),
extract_date_range(),
extract_hr(),
heat_colours(),
is_date_format(),
maxmin(),
pairwise_count(),
read_preamble(),
rgb2hex(),
totals_bind(),
totals_col(),
tstamp(),
us_to_space(),
wrap()
Examples
# Direct use
cut_hour(1:30, cuts = c(15, 20, 25))
# Use on a query
cut_hour(pq_data$Collaboration_hours, cuts = c(10, 15, 20), ubound = 150)