tabinate {divDyn} | R Documentation |
Apply function to TAxon/BIN subset of occurrences and iterATE
Description
The function takes another function and reruns it on every taxon- and/or bin-specific subsets of an occurrence dataset.
Usage
tabinate(x, bin = NULL, tax = NULL, FUN = NULL, ...)
Arguments
x |
|
bin |
|
tax |
|
FUN |
( |
... |
arguments passed to |
Details
The main tabinate
function acts as a wrapper for any type of function that requires a subset of the occurrence dataset that represents either one bin
or one tax
entry or both.
For example, the iterator can be used to calculate geographic ranges from occurrence coordinates (georange
).
The output structure of FUN should be independent from the input subset, or the function will return an error.
Setting both bin
If bin=NULL
and codetax=NULL, will run FUN
on the entire dataset (no effect). Providing either bin
or tax
and keeping the other NULL
will iterate FUN
for every bin
or tax
entry (whichever is presented).
The function returns a vector of values if the return value of FUN
is a single value. In case it is a vector, the final output will be a matrix.
When both bin
and tax
is presented, the function output will be a matrix (one output value for a taxon/bin subset) or an array (3d, when FUN
returns a vector). Setting FUN
to NULL
will return the occurrence dataset as list
s.
Value
The return object depends on the output of FUN
, as well as the bin
and tax
input.
Examples
data(corals)
# the number of different coordinate pairs in every time slice
tabinate(corals, bin="stg", FUN=georange, lat="paleolat",
lng="paleolng", method="co")
# geographic range (site occupancy) of every taxon in every bin
tabinate(corals, bin="stg", tax="genus", FUN=georange,
lat="paleolat", lng="paleolng", method="co")