cut_hour: Convert a numeric variable for hours into categorical

View source: R/cut_hour.R

cut_hourR 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: camel_clean(), check_inputs(), combine_signals(), extract_date_range(), extract_hr(), heat_colours(), is_date_format(), maxmin(), p_test(), pairwise_count(), plot_WOE(), read_preamble(), rgb2hex(), totals_bind(), totals_col(), totals_reorder(), tstamp(), us_to_space(), wrap()

Examples

# Direct use
cut_hour(1:30, cuts = c(15, 20, 25))

# Use on a query
cut_hour(sq_data$Collaboration_hours, cuts = c(10, 15, 20))


wpa documentation built on Aug. 21, 2023, 5:11 p.m.