Learn R Programming

mefa (version 1.1-4)

sscount: Make Object of Class 'sscount'

Description

The function makes an object of class 'sscount' from a data frame with columns for samples, species, count and optionally segment. Count column may contain count or measurement data, too. Data can be in 'notebook' style with empty cells.

Usage

sscount(sstable, zc = NULL, fill = FALSE, digits = NULL)

## S3 method for class 'sscount':
print(x, \dots)

Arguments

sstable
dataframe with three or four columns. Columns must be in the order of sample, species, segment (optional) and count.
zc
identifier for samples with zero count, by default it is NULL. When non existing identifier is given, the value is set to default with warning.
fill
logical, if FALSE (default), values in sstable will be left intact, if TRUE, fill.count is used to replace NA values according to the last
digits
NULL (default) is used when results are count data (eg. number of individuals). If result is not integer, but digits=NULL, error message is given. If results are not of count type but some kind of measurements (eg. bi
x
an object of class 'sscount'.
...
other arguments.

Value

  • A result is an object of class 'sscount'.
  • datadata frame with columns sample, species, segment, count. First three columns are factors, count is numeric.
  • callreturns the call.
  • zcflag for samples (rows) with 0 total count, zc="zero.count".
  • digitsstores value of digits argument, when digits is not NULL and data are of count type it is set to NULL.
  • nsamplesnumber of samples (levels) in data column sample.
  • nspeciesnumber of species (levels) in data column species, "pseudo-species" created by zc is excluded.
  • segment.levelsvector with levels in data column segment.

Details

When the zc zero count identifier is used, respective rows in the segment column of the result will be replaced by NAs, and count values with 1. Segment levels are also modifed accordingly.

See Also

drtsscount, fill.count, inflate, sscount, ttsscount

Examples

Run this code
### Example 1: simple atrificial data

ss <- data.frame(
cbind(
c("sample1","sample1","sample2","sample2","sample3","sample4"),
c("species1","species1","species1","species2","species3","zero.count"),
c("male","female","male","female","male","male")
),
c(1, 2, 10, 3, 4, 1)
)
colnames(ss) <- c("sample.id", "species.id", "gender", "catch")

sscount(ss)
sscount(ss, zc="zero.count")
sscount(ss[,c(1,2,4)], zc="zero.count")

ss[,4] <- ss[,4] + 0.23
sscount(ss, digits=0)
sscount(ss, digits=1)
sscount(ss, digits=2)


### Example 2: field data of the dolina

data(dol.count, dol.sample, landsnail)

sscount(dol.count, zc="zero.count", fill=TRUE)

Run the code above in your browser using DataLab