zipfplot: Generate Zipf plot

View source: R/zipfplot.R

zipfplotR Documentation

Generate Zipf plot

Description

zipfplot generates the Zipf plot for the input data

Usage

zipfplot(
  x,
  relative.freq = TRUE,
  smooth.line = TRUE,
  smooth.conf = TRUE,
  conf.level = 0.99,
  separate.plots = FALSE,
  data.name = FALSE,
  point.size = 3,
  point.alpha = 0.4
)

Arguments

x

Data vector, matrix or data-frame

relative.freq

Logical; if TRUE the plot shows the relative frequency on vertical axis

smooth.line

Logical; if TRUE the plot shows a smoothed line through the data using LOESS method

smooth.conf

Logical; if TRUE the plot shows confidence bands on the smoothed line (only shown if smoothed line is shown)

conf.level

The confidence level for the confidence bands on the smoothed line

separate.plots

Logical; if TRUE the plot shows

data.name

Logical; if TRUE the subtitle will state the name of the input data

point.size

Size of the points in the plot

point.alpha

Alpha-transparency of the points in the plot

Details

The Zipf plot for a dataset shows the ranks of outcomes versus their frequency on a log-log scale. It is used to determine how closely a dataset follows "Zipf's law". The present function takes in a vector of values and produces the Zipf plot. The data input can be either a vector, a matrix or a data frame. If the input data is a vector then the output will be a Zipf plot for that data vector. If the input data is a matrix or data frame then each column will be treated as a separate variable and the output will be a single Zipf plot showing each of the variables. The user can control whether the variables are shown on a single plot or separate plots.

Value

Zipf plot for the input data

Examples

try(zipfplot(sample(LETTERS, 300, replace = TRUE)))

utilities documentation built on July 1, 2022, 9:06 a.m.