Learn R Programming

simba (version 0.3-4)

liste: Convert dist-objects and matrices to database format

Description

Transposes dist objects to database list format (where each line represents a similarity value calculated between two plots, so the list has three columns containing information on plot x, plot y and information on similarity/dissimilarity). This might be useful if further database processing is intended. If the given matrix is not of class dist, the whole matrix is converted. This might be handy if species matrices are to be converted to database format.

Usage

liste(obj, x="NBX", y="NBY", entry=NULL, factorize=TRUE, 
splist=FALSE)

Arguments

obj
A distance object as it is returned from sim, dist, vegdist or
x
How the second column should be named, standard is that it contains "NBX" the neighbour X. Obsolete when splist = TRUE.
y
How the second column should be named, standard is that it contains "NBY" the neighbour Y. Obsolete when splist = TRUE.
entry
How the third column should be named. If there is nothing given, it is named "we" (whatever). Obsolete when splist = TRUE.
factorize
If naming (first two) columns should be given as factors. Defaults to TRUE.
splist
Set to TRUE if a species matrix is transformed to a database list format. Automatically removes entries with zero occurrence of the species' and names columns correspondingly (see Value).

Value

  • Returns a data.frame with three columns:
  • Col1The column names of the input matrix. If it is a dist-object only the lower triangle is used. Named plot when a species matrix is transformed with splist = TRUE.
  • Col2The row names of the input matrix. Named spec when a species matrix is transformed with splist = TRUE.
  • Col3The respective matrix entries. Named occ when a species matrix is transformed with splist = TRUE.

encoding

UTF-8

Details

Column x represents the column names of the input matrix. So if you want to reshape a species matrix, x will be the species names and y will be the plot names. If it is needed vice versa, you have to change column order. For convenience you can set splist = TRUE and you will get a species list in database format with columns representing the plot, species and occurrence information. Furthermore zero occurrences are already omitted.

See Also

reshape, data.frame. It resembles functionality of reshape - which is more flexible (but also more complex).

Examples

Run this code
data(abis)
## there are empty species entries:
sum(colSums(abis.spec)==0)
## remove empty species
abis.spec <- abis.spec[,colSums(abis.spec)!=0]
abis.spec.ls <- liste(abis.spec, splist=TRUE)

Run the code above in your browser using DataLab