Learn R Programming

wpa (version 1.4.3)

cut_hour: 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")

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".

Value

Character vector representing a converted categorical variable, appended with the label of the unit. See examples for more information.

Details

This is used within create_dist() for numeric to categorical conversion.

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

Run this code
# NOT RUN {
# 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))

# }

Run the code above in your browser using DataLab