as.xcount {mefa} | R Documentation |
The function converts a sample/species crosstable into an 'xcount' object.
as.xcount(table, species.columns = TRUE, segment = "unspecified")
table |
a data frame with sample/species count data. |
species.columns |
if FALSE , species are rows and samples are columns. By default it is TRUE . |
segment |
arbitrary name of the segment (eg. adult, juvenile, male, female) whose data are
included in the table, by default it is "unspecified" . |
A result is an 'xcount' object.
segment |
value of the segment argument. |
data |
matrix containing count data of sample/species crosstabulation. |
nsamples |
number of rows (samples) in data . |
nspecies |
number of columns (species) in data . |
Peter Solymos, Solymos.Peter@aotk.szie.hu, http://www.univet.hu/users/psolymos/personal/
sscount
, xcount
, mefa
, xorder
, check.attrib
### Example 1: simple atrificial data xc <- as.data.frame(rbind( c(4, 0, 0), c(2, 4, 0), c(0, 0, 5), c(0, 0, 0) )) rownames(xc) <- c("sample1", "sample2", "sample3", "sample4") colnames(xc) <- c("species1", "species2", "species3") xc1 <- as.xcount(xc) xc1 xc2 <- as.xcount(xc, segment = "female") xc2 ### Example 2: field data of Villany Hills ## Not run: data(vtable) v1 <- as.xcount(vtable, species.columns = FALSE) v1 v2 <- as.xcount(vtable, species.columns = FALSE, segment = "adult") v2 ## End(Not run)