abundances: Vector of frequencies of frequencies

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

A function to calculate frequencies of frequencies or the combined frequencies of frequencies of two vectors.

Usage

1
abundances(freqs, freqs0 = NULL)

Arguments

freqs

A frequency table of data vector x.

freqs0

A second optional frequency table to be merged to the freqs parameter.

Details

Freqs0 is optional. It is used in the case of calculating abundances of test data when the frequencies of the training data are already known. Freqs0 is table(x0) ,where x0 is training data. Abundances of any kind of data vector x can be calculated with table(table(x)).

Value

This function returns a named vector that is used to calculate probabilities and make classifications.

Examples

1
2
3
4
5
6
set.seed(111)
x<-rpois(10,10)
abundances(table(x))

y<-rpois(2,10)
abundances(table(x), table(y))

ville-kinnula/SPEC documentation built on Dec. 23, 2021, 3:11 p.m.