bin_variable: Bin a numeric variable

Description Usage Arguments Value

View source: R/bin_variable.R

Description

bin_variable() is a function that creates bins of either equal interval length of equal size (quartiles)

Usage

1
2
3
4
5
6
7
8
bin_variable(
  x,
  min = NULL,
  max = NULL,
  int = NULL,
  quant = NULL,
  center = FALSE
)

Arguments

x

numeric vector, variable to be binned

min

numeric, where to start binning

max

numeric, where to end binnig

int

numeric, interval length of bins

quant

interger, number of quantiles

center

logical (default = FALSE), if TRUE then bins are centered around seq(min, max, int), otherwise, min is right bound of the bottom bin etc...

Value

vector of bin labels


evanjflack/polypharmacy documentation built on Oct. 12, 2020, 10:45 a.m.