cat_num: Insert the categorical label for a vector of numerical...

Description Usage Arguments Value Examples

View source: R/categorical ranges.R

Description

Numerical data is passed along with the number of bins required. A label of binned factor ranges is returned

Usage

1
cat_num(data, num_col, bins = 4)

Arguments

data

a dataframe containing the data

num_col

is the column name containing the numerical values to be binned and labeled.

bins

is the number of bins to assign the categorical labels

Value

the categorical labels as a factor

Examples

1
2
3
4
5
6
7
8
9
# Create some data
samples <- data.frame(samp = sample(1:1000, 500, replace = T))

cat_num(samples, samp)

# Use with dplyr

library(dplyr)
samples %>% cat_num(samp)

towananalytics/tatools documentation built on Jan. 24, 2022, 7:31 p.m.