bin: Bin observations

Description Usage Arguments Details Value Examples

Description

bin combines species observations based on input environmental gradient. Number of bins or number of records can be specified. Resulting bins can also be examined using the summary option.

Usage

1
bin(sp, n, n_bins = TRUE, summary = FALSE)

Arguments

sp

data frame containing species observations as columns with an environmental gradient as the first column (needs work).

n

scalar value indicating the number of bins or number of records per bin (see n_bins).

n_bins

logical indicating if n is the number of bins (TURE; default) or records per bin.

summary

logical indicating if bin should return the binned records (FALSE; default), or a summary bins

Details

bin is used to "bin" (i.e., combine by taking the mean) species species observations for taxa used to create Biotic Response functions (est_brc). Unlike other functions in package iec, function bin takes a data frame that contains the environmental gradient as the first column.

Value

If summary = FALSE (default), bin returns data frame containing the binned species records and environmental gradient. Both of these are means. If presence/absence data are used (codes as 0/1), the mean is also a probability. If summary = TRUE, bin returns a table of the number of records per bin.

Examples

1
2
3
4
5
6
x <- data.frame(gradient = round(abs(rnorm(107)), 2),
                sp1 = rpois(107, 0.7),
                sp2 = rpois(107, 0.5))

bin(x, n = 7, summary = TRUE)
x_bin <- bin(x, n = 7)

ngwalton/iec documentation built on May 23, 2019, 4:43 p.m.