untb (version 1.0-20)

count: Construct, coerce, and test for a count object

Description

In package untb, ecosystem data is held in one of two preferred forms: census data and count data. Function count creates an object of class count, and as.count() coerces to this class.

Usage

as.count(a,add="")
count(a)
is.count(a)

Arguments

a
Ecosystem data. In function as.count(), if a table, interpret as species count data; otherwise, interpret as census data. Special dispensation is made for single rows of a dataframe
add
Character, with default "" (empty string) meaning to leave the species names unchanged. A non-empty string is prepended to the species names. This is useful if the species names are integers because the display can become confus

Value

  • Returns an object of class count.

Details

Semantically, a count is a list of species together with their abundance. In~R idiom, a count is a table of species abundances. An object of class count is a table sorted from most to least abundant species. The singletons are thus tabulated last.

Function count() takes a named vector, the elements of which are interpreted as abundances and the names of which are interpreted as species names.

See Also

census

Examples

Run this code
a <- c(rep("oak",5) ,rep("ash",2),rep("elm",3),rep("xx",4))
as.count(a)

data(saunders)
as.count(saunders[1,-(1:150)])

jj <- sample(1:5,5,replace=TRUE)
as.count(jj)
as.count(jj,add="spp.")

Run the code above in your browser using DataLab