Learn R Programming

divent (version 0.5-3)

species_distribution: 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 numeric as_species_distribution(x, ..., check_arguments = TRUE)

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

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

# S3 method for wmppp as_species_distribution(x, ..., check_arguments = TRUE)

# S3 method for character as_species_distribution(x, ..., check_arguments = TRUE)

# S3 method for factor as_species_distribution(x, ..., check_arguments = TRUE)

is_species_distribution(x)

as_probabilities(x, ...)

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

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

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

# S3 method for wmppp as_probabilities(x, ..., check_arguments = TRUE)

# S3 method for character as_probabilities(x, ..., check_arguments = TRUE)

# S3 method for factor 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 numeric as_abundances(x, round = TRUE, ..., check_arguments = TRUE)

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

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

# S3 method for wmppp as_abundances(x, ..., check_arguments = TRUE)

# S3 method for character as_abundances(x, ..., check_arguments = TRUE)

# S3 method for factor as_abundances(x, ..., check_arguments = TRUE)

is_abundances(x)

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

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

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

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.

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 rounded to the nearest integer.

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.

species_distribution() creates a species_distribution object from a vector or a matrix or a dataframe.

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. They also accept a dbmss::wmppp objects, i.e. a weighted, marked planar point pattern and count the abundances of point types, character and factor objects.

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.

Examples

Run this code
# 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")
# Character vectors
as_abundances(c("A", "C", "B", "C"))

Run the code above in your browser using DataLab