Learn R Programming

datacult (version 0.1.0)

tab_freq_cont: Generate a frequency table to a continuous variable.

Description

Bin the continuous variable, and count the occurrence of each interval.

Usage

tab_freq_cont(
  data,
  variable,
  breaks = NULL,
  labels = NULL,
  include_lowest = TRUE,
  right = FALSE
)

Value

a dataframe with distribution frequency

Arguments

data

dataframe object

variable

variable name as character

breaks

either a integer number or vector of number. Defaults to NULL

labels

label for each interval. Defaults to interval names using brackes and parentheses. Defaults to NULL.

include_lowest

logical value. If TRUE, the lower limit of interval belongs to the bin. Defaults to TRUE.

right

logical value. If TRUE, the upper limit of interval belongs to the bin. Defaults to FALSE.

Details

if breaks = NULL, then ceiling(1 + log2(n)), where n is the sample size.

Examples

Run this code
tab_freq_cont(iris, "Sepal.Width")

Run the code above in your browser using DataLab