liste {simba} | R Documentation |
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.
liste(obj, x="NBX", y="NBY", entry=NULL, factorize=TRUE, splist=FALSE)
obj |
A distance object as it is returned from sim , dist , vegdist or dist.binary or a similar matrix with class="dist". If the matrix is not of class dist a data.frame is expected and all entries are converted. Species matrices are assumed to contain sites (or plots) in rows and species in columns. |
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). |
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.
Returns a data.frame
with three columns:
Col1 |
The 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. |
Col2 |
The row names of the input matrix. Named spec when a species matrix is transformed with splist = TRUE. |
Col3 |
The respective matrix entries. Named occ when a species matrix is transformed with splist = TRUE. |
Gerald Jurasinski
reshape
, data.frame
. It resembles functionality of reshape - which is more flexible (but also more complex).
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)