count
Construct, coerce, and test for a count object
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 as.count()
coerces to this class.
- Keywords
- math
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
- In function
as.count()
, character argument with default""
(empty string) meaning to leave the species names unchanged. A non-empty string is prepended to the species names usingpaste()
. This is useful
Details
A
Function count()
takes a vector, the elements of which
are interpreted as abundances. If any of the elements are named, the
names are interpreted as species names (unnamed elements are given
the null name). If the vector is unnamed, then the species names are
upper case letters, with the first element being named
A
B
as.table()
. Note that
this means that the species names are not necessarily in alphabetical
order. To access or change species names, use names()
and
names<-
respectively.
Value
- Returns an object of class
count .
See Also
Examples
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.")