species_distribution {divent}R Documentation

Species Distributions

Description

A Species Distribution is a tibble::tibble containing species abundances or probabilities. Rows of the tibble are communities and column are species. Values are either abundances or probabilities. Special columns contain the site names, and their weights (e.g. their area or number of individuals): their names must be "site" and "weight". All other column names are considered as species names.

Usage

species_distribution(x, names = NULL, weights = NULL, check_arguments = TRUE)

as_species_distribution(x, ...)

## S3 method for class 'numeric'
as_species_distribution(x, ..., check_arguments = TRUE)

## S3 method for class 'matrix'
as_species_distribution(
  x,
  names = NULL,
  weights = NULL,
  ...,
  check_arguments = TRUE
)

## S3 method for class 'data.frame'
as_species_distribution(x, ..., check_arguments = TRUE)

is_species_distribution(x)

as_probabilities(x, ...)

## S3 method for class 'numeric'
as_probabilities(x, ..., check_arguments = TRUE)

## S3 method for class 'matrix'
as_probabilities(x, names = NULL, weights = NULL, ..., check_arguments = TRUE)

## S3 method for class 'data.frame'
as_probabilities(x, ..., check_arguments = TRUE)

is_probabilities(x)

abundances(
  x,
  round = TRUE,
  names = NULL,
  weights = NULL,
  check_arguments = TRUE
)

as_abundances(x, ...)

## S3 method for class 'numeric'
as_abundances(x, round = TRUE, ..., check_arguments = TRUE)

## S3 method for class 'matrix'
as_abundances(
  x,
  round = TRUE,
  names = NULL,
  weights = NULL,
  ...,
  check_arguments = TRUE
)

## S3 method for class 'data.frame'
as_abundances(x, ..., check_arguments = TRUE)

is_abundances(x)

## S3 method for class 'species_distribution'
as.matrix(x, use.names = TRUE, ...)

## S3 method for class 'species_distribution'
as.double(x, use.names = TRUE, ...)

## S3 method for class 'species_distribution'
as.numeric(x, use.names = TRUE, ...)

Arguments

x

an object.

names

The names of the species distributions.

weights

The weights of the sites of the species distributions.

check_arguments

If TRUE, the function arguments are verified. Should be set to FALSE to save time when the arguments have been checked elsewhere.

...

Unused.

round

If TRUE, the values of x are converted to integers.

use.names

If TRUE, the names of the species_distribution are kept in the matrix or vector they are converted to.

Details

species_distribution objects include abundances and probabilities objects.

as_species_distribution(), as_abundances() and as_probabilities format the numeric, matrix or dataframe x so that appropriate versions of community functions (generic methods such as plot or div_richness) are applied. Abundance values are rounded (by default) to the nearest integer.

as_probabilities() normalizes the vector x so that it sums to 1. It gives the same output as probabilities() with estimator = "naive".

species_distribution objects objects can be plotted by plot and autoplot.

Value

An object of classes "species_distribution" and "abundances" or "probabilities".

as.double() and its synonymous as.numeric() return a numeric vector that contains species abundances or probabilities of a single-row species_distribution. as.matrix() returns a numeric matrix if the species_distribution contains several rows. These are methods of the generic functions for class species_distribution.

References

There are no references for Rd macro ⁠\insertAllCites⁠ on this help page.

Examples

# Paracou data is a tibble
paracou_6_abd
# Class
class(paracou_6_abd)
is_species_distribution(paracou_6_abd)
# Whittaker plot fitted by a log-normal distribution
autoplot(paracou_6_abd[1,], fit_rac = TRUE, distribution = "lnorm")


[Package divent version 0.4-4 Index]