Utility functions to perform simple computations, transformations, formatting etc.

1 2 3 4 5 6 7 8 9 10 11 | ```
make.dummy(fact)
dummy2factor(x)
Hill.N2(df, margin=2)
site.summ(y, max.cut=c(2, 5, 10, 20))
sp.summ(y, n.cut=c(5, 10, 20))
write.list.Excel(x, fName)
``` |

`fact` |
a factor to convert to a matrix of dummy variables. |

`x` |
a matrix or data frame of dummy variables to convert to a factor, or a list to save as an Excel file. |

`df` |
a data frame of species abundance data. |

`margin` |
margin to calculate over: 1 = by rows, 2 = by columns. |

`fName` |
file name for Excel file. |

`y` |
data frame or matrix of species by sites data. |

`n.cut` |
cut levels of abundance for species summary (see below). |

`max.cut` |
cut levels of occurence for species sumamry. |

Function `make.dummy`

converts a factor into a matrix of dummy (1/0) variables. `dummy2factor`

converts a matrix or data frame of dummy variables into a factor.

Function `Hill.N2`

returns Hill's N2 values for species or samples for a given species by sites dataset (Hill 1973).

Function `write.list.Excel`

saves the data frames in a list object as a series of names worksheets in Excel format. Not that this function is only available on Windows. See package `WriteXLS`

for a Linux / MacOS X alternative.

`make.dummy`

returns a matrix of dummay variables. `dummy2factor`

returns a factor.

`Hill.N2`

returns a numeric vector of N2 values.

`sp.summ`

returns a matrix with columns for the number of occurences, Hill's N2 and maximum abundance of each species, and the number of occurences at abundance greater than the cut levels given in `n.cut`

.

`sam.summ`

returns a matrix with columns for the number of taxa, Hill's N2, maximum value and site total of each site (sample), and the number of taxa in each site with abundance greater than the cut levels given in `max.cut`

.

Steve Juggins

Hill, M.O. (1973) Diversity and evenness: a unifying notation and its consequences. *Ecology*, **54**, 427-432.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.