Frequency: Create a frequency distribution of 'x' by 'binWidth'.

Description Usage Arguments Value Methods (by generic) Values Note Examples

View source: R/frequency.R

Description

Frequency is a custom wrapper (mostly) for hist. It simplifies input to only data and bin width. Bins are always left included but not right, as in `[a, b)`. Frequency removes NA values (with warning) prior to binning.

Usage

1
2
3
4
5
6
7
Frequency(x, binWidth, xRange = NULL)

## S3 method for class 'Frequency'
summary(object, ...)

## S3 method for class 'Frequency'
print(x, ...)

Arguments

x

A postive numeric vector to be binned according to binWidth.

binWidth

A numeric scalar (integer) defining the bin size.

xRange

A numeric vector of length 2, supplying 'from' and 'to' for customized x-axis range. Default NULL. Recommended for consistent comparison of multiple histograms.

object

Object of class Frequency.

...

Passed on to other methods.

Value

A list (of class Frequency & class hist) containing proportion & count frequencies.

Methods (by generic)

Values

others

see hist

.

xna

number of NA values removed

.

xname

deparsed name of x, replaces hist xname

binw

value passed to binWidth

xstats

function when run will yield descriptive statistics of x

Note

Method summary written for class Frequency. Returns dataframe with fields Bin, Count, Density, Proportion. Print method also writted for class Frequency.

Examples

1
#Frequency(trammel_catch[["FL"]], binWidth = 5)

jasondubois/sportfish documentation built on July 3, 2020, 1:01 p.m.