Learn R Programming

mefa (version 1.1-4)

xcount: Makes an Object of Class 'xcount'

Description

The function makes an object of class 'xcount' from an object of class 'sscount'.

Usage

xcount(ssc, segment = 0, segment.name = NULL)

## S3 method for class 'xcount':
print(x, cutoff = 25, \dots)

## S3 method for class 'xcount':
plot(x, type = "hist", rug = FALSE, logscale = FALSE, \dots)

Arguments

ssc
an object of class 'sscount'.
segment
identifier of the segment within the 'sscount' object to make the crosstabulation, the default 0 refers to "all" segments. It can have more than one element (but less than or equal to the number of elements
segment.name
character, it has effect only when segment has more than one element. If not specified, segment value in the result is set to "mixed" (if all segments are listed, it is set to "all").
x
an object of class 'xcount'.
type
character, can be "hist" for histogram, "rank" for rank abundance/occurence curves and "biplot" for plot abundance vs. occurence data.
rug
logical, if TRUE, add rug to the plot (default is FALSE). It has effect only if type="hist".
logscale
logical, if TRUE, plotted values are $log10(y+1)$ transformed. Default FALSE leaves the values intact.
cutoff
number of samples/species with zero toal count to be listed.
...
other arguments.

Value

  • A result is an object of class 'xcount'.
  • datamatrix containing count data of sample/species crosstabulation. Crosstabulation results the same dimensions for data matrices of each segments.
  • callreturns the call.
  • segmentsegment of the 'sscount' object of which the crosstabulation was made, or "all".
  • digitsinherited from the 'sscount' object.
  • nsamplesnumber of rows (samples) in data.
  • nspeciesnumber of columns (species) in data.
  • totalcountsum of count or measurement in data.
  • presencessum of presences in data.
  • nindsa vector, containing number of individuals (or sum of measurement values) within samples.
  • srichna vector, containing number of species (based on occurences) within samples.
  • specabunda vector, containing number of individuals (or sum of measurement values) within species.
  • specoccura vector, containing number of occurences within species.

Details

If data in the 'sscount' object are of measurement type, digits value is inherited from the 'sscount' object and used in crosstabulation. For large (>2) digit values, computing time may take several seconds. Current implementation of handling measurement type data is based on the inflate function, which is not fully vectorized. The print method produces 4 graphs in one window, displaying histograms (type = "hist") or rank abundance/incidence curves (type = "rank") of the vectors ninds, srichn, specabund and specoccur. If the data are of presence/absence and not abundance type, only srichn and specoccur are displayed. These values are based on the function marmat. The option (type = "biplot") deisplays 2 graphs, one for samples and one for species, combining presence/absence and abundance data in same plots.

See Also

as.xcount, check.attrib, marmat, mefa, sscount, xorder

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")

xc1 <- xcount(sscount(ss, zc="zero"))
xc1

xc2 <- xcount(sscount(ss, zc="zero.count"))
xc2

xc3 <- xcount(sscount(ss, zc="zero.count"), 0)
xc3

xc4 <- xcount(sscount(ss, zc="zero.count"), 1)
xc4

### Example 2: field data of the dolina

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

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

(xc <- xcount(dssc))
plot(xc, type="hist")
plot(xc, type="rank", logscale = TRUE)
plot(xc, type="biplot")

xcount(dssc, "broken")
xcount(dssc, c("adult", "juvenile"))
xcount(dssc, c(1,4), "mixed")
xcount(dssc, c(1:3))

Run the code above in your browser using DataLab