Learn R Programming

analyzer (version 1.0.1)

freqTable: Frequency table and Histogram

Description

freqTable prints a frequency table and histogram of a vector.

Usage

freqTable(Value, limit = NULL)

Arguments

Value

a vector of any type

limit

Upper limit of the bars in histogram. Default is NULL, for which the function will automatically find the suitable limit. This value should be in fraction (between 0 to 1)

Value

Prints a table with columns

  • Value Value. Each row has a unique value in this table

  • Freq The frequency count of the Value

  • Proportion Proportion of the Value (= Freq / length(x))

This table is followed by a histogram with bars for each of the unique values present in the data.

Details

This function works for all type of vector type. But calling freqTable for vector with many unique values will print a very long table. If the limit parameter is left blank, then the limit of histogram is adjusted automatically and is shown at the end in brackets (eg. 50 This function is used in the explainer.

Examples

Run this code
# NOT RUN {
freqTable(mtcars$cyl)
freqTable(mtcars$mpg, limit = 0.08)

# }

Run the code above in your browser using DataLab