make_frequency_count_table: Creates a frequency count table

Description Usage Arguments Details Value Examples

View source: R/fct_functions.R

Description

make_frequency_count_table() takes a vector of species abundances and returns a frequency count table.

Usage

1
make_frequency_count_table(abundances, cautious = T)

Arguments

abundances

A numeric vector of absolute species abundances (counts of how many times the species was observed).

cautious

logical. If TRUE (default) then a vector of all zeroes will return a data frame with zero rows. If FALSE then an error will be thrown.

Details

A frequency count table is a data frame listing the frequencies ('freq') and the number of species observed that many times in the sample ('numTaxa').

If cautious = T, in the event that all of the species abundances listed are zero, the function returns a data frame with the correct labels for a frequency count table but zero rows. This is a precaution mostly designed for small scale simulations where zero species may be observed - it is unlikely to be relevant in real data.

Value

returns a data.frame.

Examples

1
2
3
4
5
6
7
8
taxa <- rnbinom(1000,0.1,0.1) # simulated abundances
make_frequency_count_table(taxa) # frequency count table

## Not run: 
# The following will produce an error:
make_frequency_count_table(rep(0,100),cautious= F)

## End(Not run)

statdivlab/rre documentation built on Nov. 5, 2019, 9:20 a.m.