mama: A (convenience) wrapper function to make matrix from a data.frame
Description
The function mama uses reshape
to transpose species data given in database list format (where each line
represents a species in a plot, so the list has three columns containing
information on plot, species and information on occurence) into a plot
species matrix (where rows represent plots and columns represent species)
for further use with other functions on vegetational data.
Usage
mama(dat)
Arguments
dat
Species data in list format. The columns have to represent plot, species, occurence information (presence/absence or abundances). Column names may differ but they must be in that order!
Value
Returns a data.frame which contains the presence/absence or abundance data of the species list. Rows represent plots, columns represent species. If you want to have it vice versa you have to use the function on a list with columns species, plots, occurrence information (in that order).
encoding
UTF-8
Details
You could reach the same result with reshape. I was just always quite confused with this. That's why i decided to do this little wrapper for convenience. It needs quite a while to run though, but this is due to reshape.
data(abis)
abis.spcls <- liste(abis.spec, splist=TRUE)
## see the list, it like what you get from a database## and return to matrix-format:abis.test <- mama(abis.spcls)