Usage Arguments Value Author(s) See Also Examples
1 | mat2dbTab(mat)
|
mat |
Ecological site x species matrix. Sites (locations) should be rows, species columns |
A data frame with the colums "SU" (sampling units), "sp" (species) and "ab" abundance.
Bottin, Marius
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
matSp<-matrix(sample(c(0,1),100,replace=T,prob=c(.7,.3)),nrow=10,ncol=10,dimnames=list(paste("site",1:10,sep=""),paste("sp",1:10,sep="")))
mat2dbTab(matSp)
## The function is currently defined as
function (mat)
{
W <- which(mat > 0, arr.ind <- T)
dbTab <- data.frame(SU = rownames(mat)[W[, "row"]], sp = colnames(mat)[W[,
"col"]], ab = mat[W])
dbTab <- dbTab[order(dbTab$SU, dbTab$sp), ]
return(dbTab)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.