Learn R Programming

prabclus (version 1.0-2)

prabinit: Presence-absence matrix initialization

Description

prabinit converts a matrix into an object of class prab (presence-absence). The matrix may be read from a file or an R-object. It may be a 0-1 matrix or a matrix with non-negative entries from which the 0-1 matrix is to be generated. print.prab is a print method for such objects.

Usage

prabinit(file = NA, prabmatrix = NA, rows.are.species = TRUE,
neighborhood = "none", distance = "kulczynski", toprab = FALSE, toprabp
= 0.05, outc = 5.2)

## S3 method for class 'prab': print(x, ...)

Arguments

file
string. 0-1 matrix ASCII file (such as example dataset kykladspecreg.dat) from which the matrix is read by read.table.
prabmatrix
matrix with non-negative entries. Either file or prabmatrix should be NA.
rows.are.species
logical. If TRUE, rows are interpreted as species and columns are interpreted as regions. In this case, rows and columns are interchanged by prabinit.
neighborhood
A string or a list with a component for every region. The components are vectors of integers indicating neighboring regions. A region without neighbors (e.g., an island) should be assigned a vector numeric(0). If neighbo
distance
"kulczinsky", "jaccard" or "none". The distance measure between species to compute by prabinit.
toprab
logical. If TRUE, a presence-absence matrix is computed from the non-negative input matrix. "Absence", i.e., the entry 0, is chosen if the original entry is 0, or the original entry is both smaller than toprabp times
toprabp
numerical between 0 and 1, see toprab.
outc
numerical. Tuning constant for the outlier identification associated with toprab=TRUE. An entry smaller than outc*mad times the median is considered as a lower outlier.
x
object of class prab.
...
necessary for print method.

Value

  • An object of class prab, which is a list with components
  • distmatdistance matrix between species.
  • prabpresence-absence matrix. Rows are regions, columns are species.
  • nbneighborhood list, see above.
  • regperspecvector of the number of regions occupied by a species.
  • specperregvector of the number of species present in a region.
  • n.speciesnumber of species.
  • n.regionsnumber of regions.
  • distancestring denoting the chosen distance measure.
  • spatialTRUE, if there is a specified neighborhood structure.

See Also

read.table, jaccard, kulczynski, nbtest

Examples

Run this code
# If you want to use your own ASCII data files, use
# x <- prabinit(file="path/prabmatrixfile",
# neighborhood="path/neighborhoodfile")
data(kykladspecreg)
# Note: If you do not use the installed package, replace this by
# kykladspecreg <- read.table("(path/)kykladspecreg.dat")
data(nb)
# Note: If you do not use the installed package, replace this by
# nb <- list()
# for (i in 1:34)
#   nb <- c(nb,list(scan(file="(path/)nb.dat",
#                   skip=i-1,nlines=1)))
prabinit(prabmatrix=kykladspecreg, neighborhood=nb)

Run the code above in your browser using DataLab